<template>
  <div class="query">
    <div class="check">
      <div class="c_left">条件搜索栏</div>
      <div class="c_right" :style="style">
        <div class="clear">
          <div class="fl">
            <span class="c_tip">医嘱内容</span>
            <el-input v-model="queryInfo.Ordername" clearable type="text" placeholder="输入医嘱内容" />
          </div>
          <div class="fl">
            <span class="c_tip">长临医嘱</span>
            <el-select
              v-model="queryInfo.IsTemp"
              filterable
              clearable
              placeholder="请选择"
              class="c_select"
            >
              <el-option
                v-for="item in selectItems.IsTemp"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </div>
          <div class="fl">
            <span class="c_tip">医嘱状态</span>
            <el-select
              v-model="queryInfo.OrderType"
              filterable
              clearable
              placeholder="请选择"
              class="c_select"
            >
              <el-option
                v-for="item in selectItems.OrderType"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </div>
          <div class="fl">
            <span class="c_tip">药品属性</span>
            <el-select
              v-model="queryInfo.DrugCode"
              filterable
              clearable
              placeholder="请选择"
              class="c_select"
            >
              <el-option
                v-for="item in selectItems.DrugCode"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </div>
        </div>
        <div class="sbtn_box">
          <el-button type="primary" class="btn_clear" @click="gslGetPatientOrdersdata">查询</el-button>
          <el-button type="danger" class="btn_clear" @click="clearFun">重置</el-button></div>
        <div v-if="!sbtnFlag" class="show_btn" @click="showMore">
          <i class="el-icon-caret-bottom" />
          <span>更多</span>
        </div>
        <div v-if="sbtnFlag" class="show_btn" @click="showHide">
          <i class="el-icon-caret-top" />
          <span>收起</span>
        </div>
      </div>
    </div>
    <div class="list_tip clear" />
    <div class="wrapper">
      <div class="wrapper-tags">
        <div class="tags-left">
<!--          <el-tag type="success">合理</el-tag>-->
<!--          <el-tag type="danger">不合理</el-tag>-->
        </div>
        <div class="tags-right">
          <el-tag><a @click="showguardianshipPlandata">监护计划</a></el-tag>
          <el-tag><a @click="showMedicationSuggestionDialog">用药建议</a></el-tag>
          <el-tag><a @click="showMediEducationdataDialog">用药教育</a></el-tag>
<!--          <el-tag><a @click="showDrugRecombinationVisible">药物重整</a></el-tag>-->
          <el-tag><a @click="showMedicationConsultationDialog">用药咨询</a></el-tag>
          <el-tag><a @click="showSummaryRecordDataDialog">简要记录</a></el-tag>
        </div>
      </div>
      <el-scrollbar ref="elbar" style="width:100%;height:400px">
      <div class="wrapper-table">
        <!--       获取单个病人的医嘱信息 -->
        <Bluetable
          ref="patientOrdersdataRef"
          :t-head="patientOrdersdataHead"
          :t-data="patientOrdersdataList"
          @selectionChange="selectionChangepatientOrdersdata"
        />
        <pagination
          :total="patientOrdersdataList.length"
          :page.sync="page.pagenum"
          :limit.sync="page.pagesize"
          @pagination="pageGetPatientOrdersdata"
        />
      </div>
      </el-scrollbar>
      <!--      用药教育主界面-->
      <el-dialog
        title="用药教育"
        :visible.sync="MediEducationListdataMainVisible"
        width="90%"
        @close="closeMediEducationdataDialog"
      >
        <div class="wrapper-guardianshipPlandata">
          <div class="guardianshipPlandata-btn">
            <el-tag><a @click="addSaveMedicationEducationndata"><i class="el-icon-plus" />创建用药教育</a></el-tag>
          </div>
          <div class="guardianshipPlandata-tab">
            <Bluetable
              ref="medicationSuggestionRef"
              :t-head="MediEducationListdataHead"
              :t-data="MediEducationListdata"
              @operateClick="operateClickMediEducationListdata"
            />
          </div>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="closeMediEducationdataDialog">关 闭</el-button>
        </span>
      </el-dialog>
      <!-- 用药教育个人信息-->
      <el-dialog
        title="用药教育详情"
        :visible.sync="mediEducationdataInfoInfoVisible"
        width="95%"
        @close="closeSaveMedicationEducationndataVisibleDialog"
      >
        <el-form>
          <div style="display: flex">
            <el-form-item label="记录时间" :label-width="formLabelWidth">
              <el-date-picker
                ref="startTime"
                v-model="mediEducationdataInfo.Recordingdate"
                value-format="yyyy/MM/dd HH:mm:ss"
                format="yyyy/MM/dd HH:mm:ss"
                type="datetime"
                placeholder="选择日期"
              />
            </el-form-item>
            <el-form-item>
              <el-select>
                <el-option label="在线病人用药教育" />
              </el-select>
            </el-form-item>

            <div style="display: flex">
              <el-form-item label="病人姓名" :label-width="formLabelWidth">
                <span>{{ patientDetail.patient_name }}</span>
              </el-form-item>

              <el-form-item label="性别" :label-width="formLabelWidth">
                <span>{{ patientDetail.sex }}</span>
              </el-form-item>

              <el-form-item label="年龄" :label-width="formLabelWidth">
                <span>{{ patientDetail.age }}</span>
              </el-form-item>

              <el-form-item label="科室" :label-width="formLabelWidth">
                <span>{{ patientDetail.deptname }}</span>
              </el-form-item>

              <el-form-item label="床号" :label-width="formLabelWidth">
                <span>{{ patientDetail.bedno }}</span>
              </el-form-item>
            </div>
          </div>
          <el-form-item label="在院诊断" :label-width="formLabelWidth">
            <span>{{ patientDetail.disname }}</span>
          </el-form-item>
          <el-form-item label="原因" :label-width="formLabelWidth">
            <el-checkbox-group v-model="mediEducationdataInfo.Reason">
              <el-checkbox label="依从性不佳" />
              <el-checkbox label="使用特殊挤型药" />
              <el-checkbox label="使用特殊药物" />
              <el-checkbox label="既往药物不良反应史" />
              <el-checkbox label="特殊人群" />
              <el-checkbox label="其他" />
            </el-checkbox-group>
          </el-form-item>

          <el-form-item label="用药情况" :label-width="formLabelWidth">
            <a><el-tag><i class="el-icon-plus" @click="selectPop('导入医嘱')">导入医嘱</i></el-tag></a>
          </el-form-item>

          <el-form-item :label-width="formLabelWidth">
            <Bluetable
              ref="medicationSuggestionRef"
              :t-head="SaveMedicationEducationndataOrdersListHead"
              :t-data="SaveMedicationEducationndataOrdersList"
              @operateClick="operateClickMedicationEducationndataOrdersList"
            />
          </el-form-item>
          <el-form-item label="其他注意事项" :label-width="formLabelWidth">
            <el-input
              v-model="mediEducationdataInfo.OtherPrecations"
              type="textarea"
              placeholder="请输入内容"
            />
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button v-if="MediEducationListdataHeadFlag === '新增'" type="primary" @click="addSaveMedicationEducationndataApi">保存</el-button>
          <el-button v-if="MediEducationListdataHeadFlag === '修改'" type="primary" @click="addSaveMedicationEducationndataApi">修改</el-button>
          <el-button type="danger" @click="closeSaveMedicationEducationndataVisibleDialog">关 闭</el-button>
          <!--          <el-button v-if="MediEducationListdataHeadFlag === '修改'" type="success" :disabled="true" @click="printfInfo">打印</el-button>-->
        </span>
      </el-dialog>
      <!--      药品信息-->
      <el-dialog
        title="药品信息"
        :visible.sync="MedicationInfoVisible"
        width="50%"
        @close="closeMedicationInfoVisible"
      >
        <el-form>
          <div style="display: flex">
            <el-form-item label="药品名称" :label-width="formLabelWidth">
              <span>{{ MedicationInfo.ordername }}</span>
            </el-form-item>
            <el-form-item label="记录时间" :label-width="formLabelWidth">
              <el-date-picker
                ref="startTime"
                v-model="MedicationInfo.startdate"
                :disabled="true"
                value-format="yyyy-MM-dd HH:mm:ss"
                format="yyyy-MM-dd HH:mm:ss"
                type="datetime"
                placeholder="选择日期"
              />
            </el-form-item>
          </div>
          <div style="display: flex">
            <el-form-item label="单次剂量" :label-width="formLabelWidth">
              <el-input v-model="MedicationInfo.SingleDose" placeholder="请输入" />
            </el-form-item>
            <el-form-item label="给药单位" :label-width="formLabelWidth">
              <el-input v-model="MedicationInfo.Administrationunit" placeholder="请输入" />
            </el-form-item>
          </div>
          <div style="display: flex">
            <el-form-item label="给药频次" :label-width="formLabelWidth">
              <div style="display: flex;align-items: center">
                <el-input v-model="MedicationInfo.AdministrationFrequency" clearable placeholder="请输入" />
              </div>
            </el-form-item>
            <el-form-item label="给药途径" :label-width="formLabelWidth">
              <el-input v-model="MedicationInfo.Routeofadministration" placeholder="请输入" />
              <i class="c_searchbtn" @click="selectPop('药品信息给药途径')">选择</i>
            </el-form-item>
          </div>

          <el-form-item label="注意事项" :label-width="formLabelWidth">
            <el-input
              v-model="mediEducationdataInfo.carematter"
              type="textarea"
              placeholder="请输入内容"
            />
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="saveMedicationInfoVisible">修改</el-button>
          <el-button type="danger" @click="closeMedicationInfoVisible">关 闭</el-button>
        </span>
      </el-dialog>
      <!--    监护计划-->
      <el-dialog
        title="提示"
        :visible.sync="guardianshipPlandataVisible"
        width="90%"
        @close="closegetGuardianshipPlandata"
      >
        <div class="wrapper-guardianshipPlandata">
          <div class="guardianshipPlandata-btn">
            <el-tag><a @click="showaddPlan"><i class="el-icon-plus" />创建新的监护计划</a></el-tag>
          </div>
          <div class="guardianshipPlandata-tab">
            <el-table
              :data="guardianshipPlandata"
              row-key="id"
              border
              :tree-props="{children: 'children'}"
            >
              <el-table-column
                prop="startdate"
                label="开始时间"
                width="200"
              />
              <el-table-column
                prop="createuser"
                label="创建人"
                width="180"
              />
              <el-table-column
                prop="guardianshipobject"
                label="监护对象"
              />
              <el-table-column
                prop="guardianshippoints"
                label="监护要点"
              />
              <el-table-column
                prop="num"
                width="100px"
                label="监护次数"
              />
              <el-table-column
                prop="enddate"
                label="结束时间"
              />
              <el-table-column label="监护过程">
                <template slot-scope="scope">
                  <el-button
                    v-if="scope.row.endflag !== '1' && scope.row.patient_node === null"
                    size="mini"
                    type="primary"
                    @click="showSonPlan(scope.$index, scope.row)"
                  >新增</el-button>
                  <el-button
                    size="mini"
                    type="success"
                    @click="showEditPlan(scope.$index, scope.row)"
                  >编辑</el-button>
                  <el-button
                    size="mini"
                    type="danger"
                    @click="delPlan(scope.$index, scope.row)"
                  >删除</el-button>
                  <!--                    @click="handleDelete(scope.$index, scope.row)"-->
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="closegetGuardianshipPlandata">取 消</el-button>
          <el-button type="primary" @click="savegetGuardianshipPlandata">确 定</el-button>
        </span>
      </el-dialog>
      <!--      新增监护计划-->
      <el-dialog
        width="70%"
        title="监护计划"
        :visible.sync="innerVisible"
        @close="closePlan"
      >
        <el-form :model="planObj">
          <el-form-item label="开始时间" :label-width="planObjFormLabelWidth">
            <el-date-picker
              v-model="planObj.Startdate"
              width="400px"
              type="datetime"
              placeholder="选择日期时间"
            />
          </el-form-item>
          <el-form-item label="监护对象" :label-width="planObjFormLabelWidth">
            <div class="planPoint">
              <el-input v-model="planObj.Guardianshipobject" style="width:90%" type="textarea" />
              <div class="plantPointBtn">
                <div>
                  <a><el-tag><i class="el-icon-plus" @click="selectPop('导入医嘱对象')">导入医嘱</i></el-tag></a>
                </div>
              </div>
            </div>
          </el-form-item>
          <el-form-item label="监护要点" :label-width="planObjFormLabelWidth">
            <div class="planPoint">
              <el-input v-model="planObj.GuardianshipPoints" style="width: 90%" type="textarea" />
              <div class="plantPointBtn">
                <div>
                  <a><el-tag><i class="el-icon-plus" @click="selectPop('导入医嘱要点')">导入医嘱</i></el-tag></a>
                </div>
                <div>
                  <el-tag><i class="el-icon-plus" @click="selectPop('导入检验')">导入检验</i></el-tag>
                </div>
              </div>
            </div>

          </el-form-item>
          <div v-if="isAddOrEdit">
            <el-form-item label="监护计划" :label-width="planObjFormLabelWidth">
              <el-radio-group v-model="planObj.Type">
                <el-radio :label="'1'">持续关注</el-radio>
                <el-radio :label="'2'">结束</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="用药建议" :label-width="planObjFormLabelWidth">
              <el-tag><a @click="showMedicationSuggestionDialog"><i class="el-icon-plus" />新增用药建议</a></el-tag>
            </el-form-item>
            <el-form-item label="提醒" :label-width="planObjFormLabelWidth">
              <a><i style="font-size: 25px" class="el-icon-date" @click="showDemindDataDialog" /></a>
            </el-form-item>
          </div>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="closePlan">取 消</el-button>
          <el-button v-if="isAddOrEdit" type="primary" @click="addPlan">新增</el-button>
          <el-button v-else type="primary" @click="editPlan">编辑</el-button>
        </span>

      </el-dialog>
      <!--      新增监护过程-->
      <el-dialog
        width="70%"
        title="监护过程"
        :visible.sync="isShowSonPlan"
      >
        <el-form :model="planObj">
          <el-form-item label="开始时间" :label-width="planObjFormLabelWidth">
            <el-date-picker
              v-model="planObj.Startdate"
              width="400px"
              type="datetime"
              placeholder="选择日期时间"
            />
          </el-form-item>
          <el-form-item label="监护对象" :label-width="planObjFormLabelWidth">
            <div class="planPoint">
              <el-input v-model="planObj.Guardianshipobject" style="width:90%" type="textarea" />
              <div class="plantPointBtn">
                <div>
                  <a><el-tag><i class="el-icon-plus" @click="selectPop('导入医嘱对象')">导入医嘱</i></el-tag></a>
                </div>
              </div>
            </div>
          </el-form-item>
          <el-form-item label="监护要点" :label-width="planObjFormLabelWidth">
            <div class="planPoint">
              <el-input v-model="planObj.GuardianshipPoints" style="width: 90%" type="textarea" />
              <div class="plantPointBtn">
                <div>
                  <a><el-tag><i class="el-icon-plus" @click="selectPop('导入医嘱要点')">导入医嘱</i></el-tag></a>
                </div>
                <div>
                  <el-tag><i class="el-icon-plus" @click="selectPop('导入检验')">导入检验</i></el-tag>
                </div>
              </div>
            </div>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="closePlan">取 消</el-button>
          <el-button type="primary" @click="saveSonPlan">新增</el-button>
        </span>
      </el-dialog>
      <!--      用药建议弹窗-->
      <el-dialog
        title="提示"
        :visible.sync="medicationSuggestionDialog"
        width="90%"
      >
        <div class="wrapper-guardianshipPlandata">
          <div class="guardianshipPlandata-btn">
            <el-tag><a @click="showAddMedicationSuggestionDialog"><i class="el-icon-plus" />新增用药建议</a></el-tag>
          </div>
          <div class="guardianshipPlandata-tab">
            <Bluetable
              ref="medicationSuggestionRef"
              :t-head="medicationSuggestionTitle"
              :t-data="medicationSuggestiondata"
              @operateClick="operateClickMedication"
            />
          </div>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="closeMedicationSuggestionDialog">确 定</el-button>
        </span>
      </el-dialog>
      <!--      新增用药建议-->
      <el-dialog
        width="70%"
        title="用药建议"
        :visible.sync="medicationSuggestion"
      >
        <el-form :model="medicationSuggestionDataObj">
          <el-form-item label="记录时间" :label-width="planObjFormLabelWidth">
            <el-date-picker
              v-model="medicationSuggestionDataObj.Recordingdate"
              width="400px"
              type="datetime"
              placeholder="选择日期时间"
            />
          </el-form-item>
          <el-form-item label="建议对象" :label-width="planObjFormLabelWidth">
            <div class="planPoint">
              <el-input v-model="medicationSuggestionDataObj.SuggestionObject" style="width:90%" type="textarea" />
              <div class="plantPointBtn">
                <div>
                  <a><el-tag><i class="el-icon-plus" @click="selectPop('用药建议医嘱对象')">导入医嘱</i></el-tag></a>
                </div>
              </div>
            </div>
          </el-form-item>
          <el-form-item label="建议内容" :label-width="planObjFormLabelWidth">
            <div class="planPoint">
              <el-input v-model="medicationSuggestionDataObj.SuggestionPoints" style="width: 90%" type="textarea" />
              <div class="plantPointBtn">
                <div>
                  <a><el-tag><i class="el-icon-plus" @click="selectPop('用药建议医嘱要点')">导入医嘱</i></el-tag></a>
                </div>
                <div>
                  <el-tag><i class="el-icon-plus" @click="selectPop('用药建议导入检验')">导入检验</i></el-tag>
                </div>
              </div>
            </div>
          </el-form-item>

          <el-form-item label="建议类型" :label-width="planObjFormLabelWidth">
            <el-checkbox-group v-model="medicationSuggestionDataObj.SuggestionType">
              <template v-for="item in suggestionType">
                <el-checkbox :key="item" :label="item" />
              </template>
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="接受医生" :label-width="planObjFormLabelWidth">
            <el-input v-model="medicationSuggestionDataObj.SuggestionDoctor" clearable class="c_search" type="text" placeholder="接受医生" />
            <i class="c_searchbtn" @click="selectPop('主管医生')">选择</i>

          </el-form-item>
          <el-form-item label="提醒" :label-width="planObjFormLabelWidth">
            <a><i style="font-size: 25px" class="el-icon-date" @click="showDemindDataDialog" /></a>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="closeAddMedicationSuggestionDialog">取 消</el-button>
          <el-button type="primary" @click="saveMedicationSuggestionDialog(optVal)">保存</el-button>
        </span>

      </el-dialog>
      <!--      提醒事项-->
      <el-dialog
        width="70%"
        title="提醒事项"
        :visible.sync="demindDataDialog"
      >
        <el-form :model="demindDataObj">
          <el-form-item label="提醒时间" :label-width="planObjFormLabelWidth">
            <el-date-picker
              v-model="demindDataObj.RemindDate"
              width="400px"
              type="datetime"
              placeholder="选择日期时间"
            />
          </el-form-item>
          <el-form-item label="建议内容" :label-width="planObjFormLabelWidth">
            <el-input v-model="demindDataObj.RemindTxt" style="width: 90%" type="textarea" />
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="closeDemindDataDialog">取 消</el-button>
          <el-button type="primary" @click="saveDemindDataDialog">保存</el-button>
        </span>

      </el-dialog>
      <!--      简要记录弹窗-->
      <el-dialog
        title="简要记录"
        :visible.sync="summaryRecordDataDialog"
        width="90%"
      >
        <div class="wrapper-guardianshipPlandata">
          <div class="guardianshipPlandata-btn">
            <el-tag><a @click="showAddSummaryRecordDataDialog"><i class="el-icon-plus" />新增简要记录</a></el-tag>
          </div>
          <div class="guardianshipPlandata-tab">
            <Bluetable
              ref="summaryRecordDataRef"
              :t-head="summaryRecordDataTitle"
              :t-data="summaryRecordData"
              @operateClick="operateClicksummaryRecordData"
            />
            <pagination
              :total="summaryRecordDataPage.total"
              :page.sync="summaryRecordDataPage.pagenum"
              :limit.sync="summaryRecordDataPage.pagesize"
              @pagination="getSummaryRecorddataList"
            />
          </div>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="closeSummaryRecordDataDialog">确 定</el-button>
        </span>
      </el-dialog>
      <!--      新增简要记录弹窗-->
      <el-dialog
        width="70%"
        title="新增简要记录弹窗"
        :visible.sync="addSummaryRecordDataDialog"
      >
        <el-form :model="summaryRecordObj">
          <el-form-item label="记录时间" :label-width="planObjFormLabelWidth">
            <el-date-picker
              v-model="summaryRecordObj.RecordDate"
              width="400px"
              type="datetime"
              placeholder="选择日期时间"
            />
          </el-form-item>
          <el-form-item label="选择类型" :label-width="planObjFormLabelWidth">
            <el-radio-group v-model="summaryRecordObj.RecordType">
              <el-radio :label="'用药咨询(简要)'" />
              <el-radio :label="'用药教育(简要)'" />
              <el-radio :label="'药物重整(简要)'" />
              <el-radio :label="'药品不良反应(简要)'" />
              <el-radio :label="'治疗分析及用药调整'" />
              <el-radio :label="'病情变化'" />
            </el-radio-group>
          </el-form-item>

          <el-form-item label="记录对象" :label-width="planObjFormLabelWidth">
            <div class="planPoint">
              <el-input v-model="summaryRecordObj.RecordObject" style="width:90%" type="textarea" />
              <div class="plantPointBtn">
                <div>
                  <a><el-tag><i class="el-icon-plus" @click="selectPop('简要记录-医嘱对象')">导入医嘱</i></el-tag></a>
                </div>
              </div>
            </div>
          </el-form-item>
          <el-form-item label="记录内容" :label-width="planObjFormLabelWidth">
            <div class="planPoint">
              <el-input v-model="summaryRecordObj.RecordContent" style="width: 90%" type="textarea" />
              <div class="plantPointBtn">
                <div>
                  <a><el-tag><i class="el-icon-plus" @click="selectPop('简要记录-医嘱要点')">导入医嘱</i></el-tag></a>
                </div>
                <div>
                  <el-tag><i class="el-icon-plus" @click="selectPop('简要记录-导入检验')">导入检验</i></el-tag>
                </div>
              </div>
            </div>
          </el-form-item>
          <el-form-item label="提醒" :label-width="planObjFormLabelWidth">
            <a><i style="font-size: 25px" class="el-icon-date" @click="showDemindDataDialog" /></a>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="closeAddSummaryRecordDataDialog">取 消</el-button>
          <el-button type="primary" @click="saveAddSummaryRecordDataDialog">新增</el-button>
        </span>
      </el-dialog>
      <!--      修改简要记录弹窗-->
      <el-dialog
        width="70%"
        title="新增简要记录弹窗"
        :visible.sync="changeSummaryRecordDataDialog"
      >
        <el-form :model="summaryRecordObj">
          <el-form-item label="记录时间" :label-width="planObjFormLabelWidth">
            <el-date-picker
              v-model="summaryRecordObj.RecordDate"
              width="400px"
              type="datetime"
              placeholder="选择日期时间"
            />
          </el-form-item>
          <el-form-item label="选择类型" :label-width="planObjFormLabelWidth">
            <el-radio-group v-model="summaryRecordObj.RecordType">
              <el-radio :label="'用药咨询(简要)'" />
              <el-radio :label="'用药教育(简要)'" />
              <el-radio :label="'药物重整(简要)'" />
              <el-radio :label="'药品不良反应(简要)'" />
              <el-radio :label="'治疗分析及用药调整'" />
              <el-radio :label="'病情变化'" />
            </el-radio-group>
          </el-form-item>

          <el-form-item label="记录对象" :label-width="planObjFormLabelWidth">
            <div class="planPoint">
              <el-input v-model="summaryRecordObj.RecordObject" style="width:90%" type="textarea" />
              <div class="plantPointBtn">
                <div>
                  <a><el-tag><i class="el-icon-plus" @click="selectPop('简要记录-医嘱对象')">导入医嘱</i></el-tag></a>
                </div>
              </div>
            </div>
          </el-form-item>
          <el-form-item label="记录内容" :label-width="planObjFormLabelWidth">
            <div class="planPoint">
              <el-input v-model="summaryRecordObj.RecordContent" style="width: 90%" type="textarea" />
              <div class="plantPointBtn">
                <div>
                  <a><el-tag><i class="el-icon-plus" @click="selectPop('简要记录-医嘱要点')">导入医嘱</i></el-tag></a>
                </div>
                <div>
                  <el-tag><i class="el-icon-plus" @click="selectPop('简要记录-导入检验')">导入检验</i></el-tag>
                </div>
              </div>
            </div>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="closeAddSummaryRecordDataDialog">取 消</el-button>
          <el-button type="primary" @click="saveAddSummaryRecordDataDialog">修改</el-button>
        </span>
      </el-dialog>
      <!--      用药咨询-->
      <el-dialog
        title="用药咨询"
        :visible.sync="medicationConsultationDialog"
        width="90%"
      >
        <div class="wrapper-guardianshipPlandata">
          <div class="guardianshipPlandata-tab">
            <div>
              <el-form :model="summaryRecordObj">
                <div style="display: flex">
                  <el-form-item label="咨询对象" :label-width="planObjFormLabelWidth">
                    <el-input v-model="queryMedicationConsultationObj.ConsultationObject" clearable class="c_search" type="text" placeholder="咨询对象" />
                    <i class="c_searchbtn" @click="selectPop('咨询对象')">选择</i>
                  </el-form-item>
                  <el-form-item label="填写人" :label-width="planObjFormLabelWidth">
                    <el-select
                      v-model="queryMedicationConsultationObj.Inputuser"
                      filterable
                      clearable
                      placeholder="请选择"
                      class="c_select"
                    >
                      <el-option
                        v-for="item in InputuserList"
                        :key="item.key"
                        :label="item.value"
                        :value="item.key"
                      />
                    </el-select>
                  </el-form-item>
                  <el-form-item label="具体问题/药师解答" label-width="150px">
                    <el-input v-model="queryMedicationConsultationObj.Problems" class="text" clearable type="text" placeholder="多个问题以','分开" />
                  </el-form-item>
                </div>
                <el-form-item label="咨询类别" :label-width="planObjFormLabelWidth">
                  <el-checkbox-group v-model="queryMedicationConsultationObj.ConsultationType" class="c_checkbox">
                    <el-checkbox label="药理作用" />
                    <el-checkbox label="药动学" />
                    <el-checkbox label="药物选用" />
                    <el-checkbox label="用法" />
                    <el-checkbox label="用量" />
                    <el-checkbox label="相互作用" />
                    <el-checkbox label="配伍" />
                    <el-checkbox label="不良反应" />
                    <el-checkbox label="治疗方案" />
                    <el-checkbox label="疗程" />
                    <el-checkbox label="贮存" />
                    <el-checkbox label="服药注意事项" />
                    <el-checkbox label="联合用药" />
                    <el-checkbox label="药品基本信息:名称、价格、剂量规格、供应情况" />
                  </el-checkbox-group>
                </el-form-item>
                <el-form-item label="" :label-width="planObjFormLabelWidth">
                  <el-button type="primary" @click="btnMedicationConsultationdata">查询</el-button>
                  <el-button type="success" @click="showaAddMedicationConsultation">新增</el-button>
                  <el-button type="danger" @click="clearQueryMedicationConsultationObj">重置</el-button>
                </el-form-item>
              </el-form>
            </div>
            <div>
              <Bluetable
                ref="blueTable"
                :t-head="MedicationConsultationListdataTitle"
                :t-data="MedicationConsultationListdata"
                @operateClick="operateClickMedicationConsultationdata"
              />
              <pagination
                :total="queryMedicationConsultationPage.total"
                :page.sync="queryMedicationConsultationPage.pagenum"
                :limit.sync="queryMedicationConsultationPage.pagesize"
                @pagination="pageMedicationConsultationdata"
              />
            </div>
          </div>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="closeMedicationConsultationDialog">确 定</el-button>
        </span>
      </el-dialog>
      <!--      新增用药咨询-->
      <el-dialog
        width="70%"
        title="新增用药咨询"
        :visible.sync="addMedicationConsultationDialog"
        @close="closeAddMedicationConsultation"
      >
        <el-form :model="medicationConsultationDialogObj">
          <div style="display:flex">
            <el-form-item label="姓名" :label-width="formLabelWidth">
              <el-input v-model="medicationConsultationDialogObj.ConsultantName" clearable />
              <i class="dialog_searchbtn" style="visibility:hidden;">布局</i>
            </el-form-item>
            <el-form-item label="身份" :label-width="formLabelWidth">
              <el-select
                v-model="medicationConsultationDialogObj.ConsultantIdentity"
                width="190px"
                filterable
                clearable
                placeholder="请选择"
                class="c_select"
              >
                <el-option
                  v-for="item in ConsultantIdentityList"
                  :key="item.key"
                  :label="item.value"
                  :value="item.key"
                />
              </el-select>
              <i class="dialog_searchbtn" style="visibility:hidden;">布局</i>
            </el-form-item>
            <el-form-item label="咨询状态" :label-width="formLabelWidth">
              <el-select
                v-model="medicationConsultationDialogObj.ConsultantStatus"
                filterable
                clearable
                placeholder="请选择"
                class="c_select"
              >
                <el-option
                  v-for="item in ConsultantStatusList"
                  :key="item.key"
                  :label="item.value"
                  :value="item.key"
                />
              </el-select>
            </el-form-item>
          </div>
          <div style="display:flex">

            <el-form-item label="科室" :label-width="formLabelWidth">
              <el-input v-model="medicationConsultationDialogObj.ConsultantDept" clearable class="c_search" type="text" placeholder="科室" />
              <i class="dialog_searchbtn" @click="selectPop('科室')">选择</i>
            </el-form-item>
            <el-form-item label="咨询对象" :label-width="formLabelWidth">
              <el-input v-model="medicationConsultationDialogObj.ConsultationObject" clearable class="c_search" type="text" placeholder="咨询对象" />
              <i class="dialog_searchbtn" @click="selectPop('咨询对象')">选择</i>
            </el-form-item>
            <el-form-item label="咨询时间" :label-width="formLabelWidth">
              <el-date-picker
                v-model="medicationConsultationDialogObj.ConsultationDate"
                width="400px"
                type="datetime"
                placeholder="选择日期时间"
              />
            </el-form-item>
          </div>
          <el-form-item label="咨询类别" :label-width="formLabelWidth">
            <el-checkbox-group v-model="medicationConsultationDialogObj.ConsultationType" class="c_checkbox">
              <el-checkbox label="药理作用" />
              <el-checkbox label="药动学" />
              <el-checkbox label="药物选用" />
              <el-checkbox label="用法" />
              <el-checkbox label="用量" />
              <el-checkbox label="相互作用" />
              <el-checkbox label="配伍" />
              <el-checkbox label="不良反应" />
              <el-checkbox label="治疗方案" />
              <el-checkbox label="疗程" />
              <el-checkbox label="贮存" />
              <el-checkbox label="服药注意事项" />
              <el-checkbox label="联合用药" />
              <el-checkbox label="药品基本信息:名称、价格、剂量规格、供应情况" />
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="具体问题" :label-width="formLabelWidth">
            <el-input v-model="medicationConsultationDialogObj.ConcreteProblems" style="width:95%" type="textarea" />
          </el-form-item>
          <el-form-item label="药师解答" :label-width="formLabelWidth">
            <el-input v-model="medicationConsultationDialogObj.PharmacistAnswers" style="width:95%" type="textarea" />
          </el-form-item>
          <el-form-item label="咨询结果" :label-width="formLabelWidth">
            <el-radio-group v-model="medicationConsultationDialogObj.ConsultationResult">
              <el-radio :label="'采纳意见'" />
              <el-radio :label="'部分采纳'" />
              <el-radio :label="'不采纳'" />
              <el-radio :label="'未知'" />
            </el-radio-group>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="closeAddMedicationConsultation">取 消</el-button>
          <el-button type="primary" @click="saveMedicationConsultation">新增</el-button>
        </span>
      </el-dialog>
      <!--      修改用药咨询-->
      <el-dialog
        width="70%"
        title="用药咨询信息"
        :visible.sync="changeMedicationConsultationObjDialog"
        @close="closeAddMedicationConsultation"
      >
        <el-form :model="changeMedicationConsultationObj">
          <el-form-item label="咨询时间" :label-width="formLabelWidth">
            <el-date-picker
              v-model="changeMedicationConsultationObj.consultationdate"
              width="400px"
              type="datetime"
              placeholder="选择日期时间"
            />
          </el-form-item>

          <el-form-item label="咨询对象" :label-width="formLabelWidth">
            <el-input v-model="changeMedicationConsultationObj.drugname" style="width:95%" type="textarea" />
          </el-form-item>

          <el-form-item label="填写人" :label-width="formLabelWidth">
            <el-input v-model="changeMedicationConsultationObj.inputuser" style="width:95%" type="textarea" />
          </el-form-item>

          <el-form-item label="具体问题" :label-width="formLabelWidth">
            <el-input v-model="changeMedicationConsultationObj.concreteproblems" style="width:95%" type="textarea" />
          </el-form-item>

          <el-form-item label="药师解答" :label-width="formLabelWidth">
            <el-input v-model="changeMedicationConsultationObj.pharmacistanswers" style="width:95%" type="textarea" />
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="closeAddMedicationConsultation">取 消</el-button>
          <el-button type="primary" @click="saveMedicationConsultationdata">修改</el-button>
        </span>
      </el-dialog>
      <!--      药物重整-->
      <el-dialog
        width="90%"
        title="药物重整"
        :visible.sync="getDrugRecombinationVisible"
        @close="closeDrugRecombinationVisible"
      >
        <el-form :model="getMediEducationListdataInfo">

          <div style="display: flex">
            <el-form-item label="记录时间" :label-width="formLabelWidth">
              <el-date-picker
                v-model="getMediEducationListdataInfo.RecordDate"
                type="datetime"
                placeholder="选择日期时间"
              />
            </el-form-item>
            <el-form-item label="住院号" :label-width="formLabelWidth">
              <el-input v-model="getMediEducationListdataInfo.Inpno" placeholder="住院号" />
              <span style="margin-left: 10px">
                <el-radio-group v-model="getMediEducationListdataInfo.InpStatus">
                  <el-radio :label="'1'">入院MR</el-radio>
                  <el-radio :label="'2'">转科MR</el-radio>
                </el-radio-group>
              </span>
            </el-form-item>

            <el-form-item label="当前科室" :label-width="formLabelWidth">
              <el-input v-model="getMediEducationListdataInfo.Deptname" :disabled="true" placeholder="请选择" />
              <el-button type="primary">主要按钮</el-button>
            </el-form-item>
          </div>

          <div style="display: flex">
            <el-form-item label="病人姓名" :label-width="formLabelWidth">
              <el-input v-model="getMediEducationListdataInfo.Patient_name" style="width: 200px" placeholder="病人姓名" />
            </el-form-item>

            <el-form-item label="性别" :label-width="formLabelWidth">
              <el-radio-group v-model="getMediEducationListdataInfo.Sex">
                <el-radio :label="'女'" />
                <el-radio :label="'男'" />
                <el-radio :label="'不详'" />
              </el-radio-group>
            </el-form-item>

            <el-form-item label="出生日期" :label-width="formLabelWidth">
              <el-date-picker
                v-model="getMediEducationListdataInfo.Birthdate"
                type="datetime"
                placeholder="出生日期"
              />
            </el-form-item>

            <el-form-item label="病人年龄" :label-width="formLabelWidth">
              <el-input v-model="getMediEducationListdataInfo.Age" placeholder="病人年龄" />
            </el-form-item>
          </div>

          <div style="display: flex">
            <el-form-item label="药物过敏史" :label-width="formLabelWidth">
              <el-radio-group v-model="getMediEducationListdataInfo.DrugAllergy">
                <el-radio :label="'1'">有</el-radio>
                <el-radio :label="'0'">无</el-radio>
              </el-radio-group>
              <el-input v-model="getMediEducationListdataInfo.DrugAllergyText" type="textarea" />
            </el-form-item>

            <el-form-item label="药物不良反应史" :label-width="formLabelWidth">
              <el-radio-group v-model="getMediEducationListdataInfo.DrugAdverse">
                <el-radio :label="'1'">有</el-radio>
                <el-radio :label="'0'">无</el-radio>
              </el-radio-group>
              <el-input v-model="getMediEducationListdataInfo.DrugAdverseText" type="textarea" />
            </el-form-item>

            <el-form-item label="相关重要信息" :label-width="formLabelWidth">
              <el-checkbox v-model="getMediEducationListdataInfo.SmokingHistory" true-label="1" false-label="0">吸烟史</el-checkbox>
              <el-checkbox v-model="getMediEducationListdataInfo.DrinkingHistory" true-label="1" false-label="0">饮酒史</el-checkbox>
              <el-checkbox v-model="getMediEducationListdataInfo.LiverdiseaseHistory" true-label="1" false-label="0">肝病史</el-checkbox>
              <el-checkbox v-model="getMediEducationListdataInfo.NephropathyHistory" true-label="1" false-label="0">肾病史</el-checkbox>
              <el-input v-model="getMediEducationListdataInfo.Others" placeholder="其他相关信息" type="textarea" />
            </el-form-item>
          </div>

          <el-form-item label="既往病史及药物治疗史" :label-width="formLabelWidth2">
            <a><el-tag><i class="el-icon-plus" @click="selectPop('既往病史及药物治疗史')">导入既往病史及药物治疗史</i></el-tag></a>
          </el-form-item>
          <el-scrollbar ref="elbar11" style="margin-left:20px;width:1300px;height:200px">
            <Bluetable
              ref="blueTable"
              :t-head="DrugDiseaseListHead"
              :t-data="DrugDiseaseList"
              @operateClick="operateClickDrugDiseaseList"
            />
          </el-scrollbar>

          <el-form-item label="既往病史及非药物治疗史" :label-width="formLabelWidth2">
            <a><el-tag><i class="el-icon-plus" @click="selectPop('既往病史及非药物治疗史')">导入既往病史及非药物治疗史</i></el-tag></a>
          </el-form-item>
          <el-scrollbar ref="elbar21" style="margin-left:20px;width:1300px;height:200px">
            <Bluetable
              ref="blueTable"
              :t-head="getPatientDisListHead"
              :t-data="DiseaseList"
              @operateClick="operateClickDiseaseList"
            />
          </el-scrollbar>

          <el-form-item label="药师评估和建议" :label-width="formLabelWidth2">
            <a><el-tag><i class="el-icon-plus" @click="showevaluationListInfoVisible">导入药师评估和建议</i></el-tag></a>
          </el-form-item>
          <el-scrollbar ref="elbar31" style="margin-left:20px;width:1300px;height:200px">
            <Bluetable
              ref="blueTable"
              :t-head="EvaluationListHead"
              :t-data="EvaluationList"
              @operateClick="operateClickEvaluationList"
            />
          </el-scrollbar>

          <el-form-item label="备注" :label-width="formLabelWidth">
            <el-input v-model="getMediEducationListdataInfo.Remarks" placeholder="备注信息" type="textarea" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <template v-if="getDrugRecombinationFlag === '新增'">
            <el-button @click="closeDrugRecombinationVisible">取 消</el-button>
            <el-button type="primary" @click="SaveDrugRecombination">新 增</el-button>
          </template>
          <template v-else-if="getDrugRecombinationFlag === '修改'">
            <el-button @click="closeDrugRecombinationVisible">取 消</el-button>
            <el-button type="danger" @click="deleteSaveDrugRecombination">删 除</el-button>
            <el-button type="primary" @click="SaveDrugRecombination">修 改</el-button>
          </template>
        </div>
      </el-dialog>

      <el-dialog
        title="药师评估和建议"
        :visible.sync="evaluationListInfoVisible"
        @close="closeevaluationListInfoVisible"
      >
        <el-form :model="evaluationListInfo">
          <el-form-item label="记录时间" :label-width="formLabelWidth">
            <el-date-picker
              v-model="evaluationListInfo.evaluationtime"
              type="datetime"
              placeholder="选择日期时间"
            />
          </el-form-item>
          <el-form-item label="用药问题" :label-width="formLabelWidth">
            <el-input v-model="evaluationListInfo.medicationproblems" placeholder="用药问题" type="textarea" />
          </el-form-item>
          <el-form-item label="问题分析" :label-width="formLabelWidth">
            <el-input v-model="evaluationListInfo.problemanalysis" placeholder="问题分析" type="textarea" />
          </el-form-item>
          <el-form-item label="MR建议" :label-width="formLabelWidth">
            <el-input v-model="evaluationListInfo.mrproposal" placeholder="MR建议" type="textarea" />
          </el-form-item>
          <el-form-item label="结果" :label-width="formLabelWidth">
            <el-input v-model="evaluationListInfo.result" placeholder="结果" type="textarea" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="closeevaluationListInfoVisible">取 消</el-button>
          <el-button type="primary" @click="saveevaluationListInfoVisible">确 定</el-button>
        </div>
      </el-dialog>

    </div>
    <Poptable
      ref="ptable"
      :patient_id="patientDetail.patient_id"
      :visit_id="patientDetail.visit_id"
      :p-type="pType"
      ctype="zy"
      @handleCurrentPatientOrdersListObj="handleCurrentPatientOrdersListObj"
      @handleCurrentPatientOrdersListPoint="handleCurrentPatientOrdersListPoint"
      @handleCurrentPatientLabdata="handleCurrentPatientLabdata"
      @handleSuggestionObject="handleSuggestionObject"
      @handleSuggestionPoints="handleSuggestionPoints"
      @handleSummaryRecordObj="handleSummaryRecordObj"
      @handleSummaryRecordPoints="handleSummaryRecordPoints"
      @handleConsultationObject="handleConsultationObject"
      @handleDeptcode="handleDeptcode"
      @handleDoctorcode="handleDoctorcode"
      @handleCurrentPatientOrdersList="handleCurrentPatientOrdersList"
      @handleMedicationRoutecode="handleMedicationRoutecode"
      @handlePatientDrugDisListdata="handlePatientDrugDisListdata"
      @handlePatientDisListdata="handlePatientDisListdata"
    />
    <!--startprint-->
    <!--    <div id="printcontent">-->
    <!--      <div class="title"><h3>在院病人用药指导单</h3></div>-->
    <!--      <div class="fgx" />-->
    <!--      <div class="patient_info">-->
    <!--        <div class="item">-->
    <!--          <div class="item_title">姓名:</div>-->
    <!--          <div class="item_content">撒打算</div>-->
    <!--        </div>-->
    <!--        <div class="item">-->
    <!--          <div class="item_title">性别:</div>-->
    <!--          <div class="item_content">男</div>-->
    <!--        </div>-->
    <!--        <div class="item">-->
    <!--          <div class="item_title">年龄:</div>-->
    <!--          <div class="item_content">10</div>-->
    <!--        </div>-->
    <!--        <div class="item">-->
    <!--          <div class="item_title">床号:</div>-->
    <!--          <div class="item_content">10</div>-->
    <!--        </div>-->
    <!--      </div>-->
    <!--      <div class="zyzd">-->
    <!--        <div class="title">在院诊断:</div>-->
    <!--        <div class="content">sadas</div>-->
    <!--      </div>-->
    <!--      <div class="fgx" />-->
    <!--      <div class="tabs">-->
    <!--        <div class="title"><h4>用药情况</h4></div>-->
    <!--        <div class="tablecontent">-->
    <!--          <table-->
    <!--            border="1"-->
    <!--            cellspacing="0"-->
    <!--            cellpadding="0"-->
    <!--            style="border-collapse: collapse"-->
    <!--            width="100%"-->
    <!--          >-->
    <!--            <tr height="40">-->
    <!--              <th>药品名称/商品名</th>-->
    <!--              <th>用法用量</th>-->
    <!--              <th>开嘱时间</th>-->
    <!--            </tr>-->
    <!--            <template>-->
    <!--              <tr style="text-align: center;">-->
    <!--                <td>啊实打实</td>-->
    <!--                <td>55</td>-->
    <!--                <td>撒打算</td>-->
    <!--              </tr>-->
    <!--            </template>-->
    <!--          </table>-->

    <!--        </div>-->

    <!--      </div>-->
    <!--      <hr class="fgx2">-->
    <!--      <div class="zysx">-->
    <!--        <div class="title"><h4>请仔细阅读以下注意事项</h4></div>-->
    <!--        <div class="item">-->
    <!--          <div class="item-title"><h4>sada</h4></div>-->
    <!--          <div class="item-content">sadasdddddddddddddddddddddddddddddddddddddddda</div>-->
    <!--          <div class="item-content">sada</div>-->
    <!--        </div>-->
    <!--      </div>-->
    <!--      <hr class="fgx2">-->
    <!--      <div class="zysx">-->
    <!--        <div class="title"><h4>其他注意事项</h4></div>-->
    <!--        <div class="item">-->
    <!--          <div class="item-content">sadasdddddddddddddddddddddddddddddddddddddddda</div>-->
    <!--        </div>-->
    <!--      </div>-->
    <!--      <div class="author">-->
    <!--        <div class="name">临床药师:xxx</div>-->
    <!--      </div>-->

    <!--    </div>-->
    <!--endprint-->
  </div>
</template>

<script>
import { gslGetPatientOrdersdata,
  gslGetMedicationSuggestiondata,
  gslGetGuardianshipPlandata,
  gslSaveGuardianshipPlandata,
  gslSaveMedicationSuggestiondata,
  gslSaveReminddata,
  gslGetSummaryRecorddata,
  gslSaveSummaryRecorddata,
  getMedicationConsultationdata,
  saveMedicationConsultationdata,
  GetMediEducationdata,
  SaveMedicationEducationndata,
  GetDrugRecombination, SaveDrugRecombination } from '@/api/cpw'

import Poptable from '../../components/poptable'
import axios from 'axios'
export default {
  name: 'PatientOrdersdata',
  components: {
    Poptable
  },
  props: {
    patientDetailFather: {
      type: Object
    }
  },

  mounted() {
    let userInfo = localStorage.getItem("user");
    this.Username = JSON.parse(userInfo).real_name
    this.Userid = JSON.parse(userInfo).user_no
  },
  activated() {
    let userInfo = localStorage.getItem("user");
    this.Username = JSON.parse(userInfo).real_name
    this.Userid = JSON.parse(userInfo).user_no
  },
  data() {
    return {
      Userid: '',
      Username: '',
      patientDetail: {
        // // 测试数据，需修改
        // Patient_id: '227058',
        // Visit_id: '3',
        // Deptcode: '00191',
        // Deptname: '妇科',
        // Bedno: '67'
      },
      page: {
        pagesize: 10,
        pagenum: 1
      },
      queryInfo: {
        Ordername: '',
        IsTemp: '',
        OrderType: '',
        DrugCode: ''
      },
      selectItems: {
        IsTemp: [{
          value: '0',
          label: '长期'
        }, {
          value: '1',
          label: '临时'
        }, {
          value: '2',
          label: '长期和临时'
        }],
        OrderType: [{
          value: '1',
          label: '已停嘱'
        }, {
          value: '2',
          label: '在用'
        }],
        DrugCode: [{
          value: '1',
          label: '抗菌药 '
        }, {
          value: '2',
          label: '中药饮片'
        }, {
          value: '3',
          label: '中成药'
        }, {
          value: '4',
          label: '基本药物'
        }, {
          value: '5',
          label: '兴奋剂'
        }, {
          value: '6',
          label: '糖皮质激素'
        }, {
          value: '7',
          label: '血液制品'
        }, {
          value: '8',
          label: '肿瘤药物'
        }]
      },
      // 接口获得单个病人医嘱信息
      patientOrdersdataList: [],
      patientOrdersdataHead: [
        {
          selection: true
        }, {
          prop: 'comment_result',
          label: '审核',
          width: '75px'
        }, {
          prop: 'is_temp',
          label: '长/临',
          width: '50px'
        }, {
          prop: '',
          label: '警',
          width: '50px'
        }, {
          prop: '',
          label: '发送',
          width: '50px'
        }, {
          prop: 'grouptagcolor',
          label: '组',
          width: '50px'
        }, {
          prop: 'ordername',
          label: '医嘱内容'
        }, {
          prop: 'drugspec',
          label: '规格',
          width: '100px'
        }, {
          prop: 'routename',
          label: '用法用量'
        }, {
          prop: 'remark',
          label: '补充用法'
        }, {
          prop: 'startdatetime',
          label: '开嘱时间',
          width: '90px'
        }, {
          prop: 'enddatetime',
          label: '停嘱时间',
          width: '90px'
        }

      ],
      sbtnFlag: false,
      style: 'height: 60px;padding-top: 10px;',
      // 监护计划
      guardianshipPlandataVisible: false,
      // 监护计划
      guardianshipPlandata: [],
      // 用药建议 ========================================
      // 用药建议列表弹窗
      medicationSuggestionDialog: false,
      medicationSuggestiondata: [],
      // 用药建议表头
      medicationSuggestionTitle: [
        {
          operate: ['修改', '删除'],
          label: '操作',
          link: true,
          width: '100px'
        },
        {
          prop: 'recordingdate',
          label: '记录时间',
          width: '90px'
        }, {
          prop: 'createuser',
          label: '创建人'
        }, {
          prop: 'suggestionobject',
          label: '建议对象'
        }, {
          prop: 'suggestionpoints',
          label: '建议内容'
        }, {
          prop: 'suggestiontype',
          label: '建议类型'
        }, {
          prop: 'suggestiondoctor',
          label: '建议接受的医生',
          width: '120px'
        }, {
          prop: 'sendingstate',
          label: '是否发送状态'
        }, {
          prop: 'pharmacistreply',
          label: '药师回复'
        }, {
          prop: 'visit_id',
          label: '住院次数'
        }, {
          prop: 'deptname',
          label: '科室名称'
        }, {
          prop: 'doctorcode',
          label: '医生代码'
        }
      ],
      // 用药建议
      medicationSuggestion: false,
      medicationSuggestionDataObj: {
        Recordingdate: '',
        SuggestionObject: '',
        SuggestionPoints: '',
        SuggestionType: [],
        SuggestionDoctor: '',
        SuggestionStatus: ''
      },
      // 用药建议 建议类型
      suggestionType: [
        '适应症', '药物选择', '单次剂量', '每日给药次数', '跟换药品', '溶媒选择', '用药终止',
        '联合用药', '改变用药途径', '增加新的药物', '跟换剂型', '基因检验', '药物不良反应', '药物重整'
      ],
      optVal: '新增',
      optId: '',
      // 用药建议 ========================================
      // 创建新的监护计划
      innerVisible: false,
      // 判断是新增还是编辑
      // true是add
      isAddOrEdit: true,
      // 监护计划
      planObj: {
        Startdate: '',
        Guardianshipobject: '',
        GuardianshipPoints: '',
        Type: ''
      },
      planObjId: '',
      planObjFormLabelWidth: '120px',
      // 监护过程
      isShowSonPlan: false,
      pType: '11',
      // 提醒事项
      demindDataDialog: false,
      demindDataObj: {
        RemindDate: '',
        RemindTxt: ''
      },
      // 简要记录
      // 简要记录弹窗
      summaryRecordDataDialog: false,
      // 简要记录表格数据
      summaryRecordData: [],
      // 表格分页
      summaryRecordDataPage: {
        pagesize: 10,
        pagenum: 1,
        total: 0
      },
      // 简要记录表头
      summaryRecordDataTitle: [
        {
          operate: ['修改', '删除'],
          label: '操作',
          link: true,
          width: '150px'
        },
        {
          prop: 'patient_id',
          label: '病人号',
          width: '120px'
        }, {
          prop: 'visit_id',
          label: '住院数',
          width: '120px'
        }, {
          prop: 'recorddate',
          label: '记录时间'
        }, {
          prop: 'recordtype',
          label: '选择类型'
        }, {
          prop: 'recordobject',
          label: '记录对象'
        }, {
          prop: 'recordcontent',
          label: '记录内容'
        }
      ],
      // 新增简要记录弹窗
      addSummaryRecordDataDialog: false,
      changeSummaryRecordDataDialog: false,
      // 新增简要记录对象
      summaryRecordObj: {
        RecordDate: '',
        RecordType: '',
        RecordObject: '',
        RecordContent: ''
      },
      // 用药咨询=======================================
      // 用药咨询弹窗
      medicationConsultationDialog: false,
      // 用药咨询查询条件
      queryMedicationConsultationObj: {
        ConsultationObject: '',
        Inputuser: '',
        Problems: '',
        ConsultationType: []
      },
      // 用药咨询查询条件分页
      queryMedicationConsultationPage: {
        pagesize: 10,
        pagenum: 1,
        total: 0
      },
      // 用药咨询填写人
      InputuserList: [
        {
          key: '001',
          value: '001'
        }
      ],
      // 用药咨询表头
      MedicationConsultationListdataTitle: [
        {
          operate: ['修改', '删除'],
          label: '操作',
          link: true,
          width: '100px'
        }, {
          prop: 'consultationdate',
          label: '咨询时间'
        }, {
          prop: 'drugname',
          label: '咨询对象'
        }, {
          prop: 'inputuser',
          label: '填写人'
        }, {
          prop: 'concreteproblems',
          label: '具体问题'
        }, {
          prop: 'pharmacistanswers',
          label: '药师解答'
        }],
      // 用药咨询分页数据
      MedicationConsultationListdata: [],
      // 新增/修改弹窗显示
      addMedicationConsultationDialog: false,
      // 弹窗数据对象
      medicationConsultationDialogObj: {
        ConsultationDate: '',
        ConsultantStatus: '',
        ConsultantDept: '',
        ConsultantIdentity: '',
        ConsultantName: '',
        ConsultationObject: '',
        ConsultationType: [],
        ConcreteProblems: '',
        PharmacistAnswers: '',
        ConsultationResult: ''
      },
      // 咨询状态
      ConsultantStatusList: [
        {
          key: '1',
          value: '住院'
        }, {
          key: '2',
          value: '出院'
        }
      ],
      ConsultantIdentityList: [
        {
          key: '1',
          value: '医生'
        }, {
          key: '2',
          value: '护士'
        }, {
          key: '3',
          value: '药师'
        }, {
          key: '4',
          value: '患者'
        }
      ],
      formLabelWidth: '120px',
      formLabelWidth2: '170px',
      changeMedicationConsultationObjDialog: false,
      // 查看你/修改/删除弹窗数据
      changeMedicationConsultationObj: {
        concreteproblems: '',
        consultationdate: '',
        drugname: '',
        inputuser: '',
        pharmacistanswers: ''
      },
      // 用药咨询=======================================

      // 用药教育 ===========================================

      // 用药教育列表
      // 用药教育主界面弹窗
      MediEducationListdataMainVisible: false,
      mediEducationdataInfoInfoVisible: false,
      MediEducationListdataHeadFlag: '新增',
      // 用药教育主界面的数据
      MediEducationListdata: [],
      // 用药教育主界面表头
      MediEducationListdataHead: [
        {
          operate: ['修改', '删除'],
          label: '操作',
          link: true,
          width: '100px'
        }, {
          prop: 'recordingdate',
          label: '记录时间'
        }, {
          prop: 'patient_name',
          label: '病人姓名'
        }, {
          prop: 'sex',
          label: '性别'
        }, {
          prop: 'age',
          label: '年龄'
        }, {
          prop: 'deptname',
          label: '科室'
        }, {
          prop: 'bedno',
          label: '床号'
        }, {
          prop: 'disname',
          label: '在院诊断'
        }, {
          prop: 'reason',
          label: '用药教育原因'
        }, {
          prop: 'otherprecautions',
          label: '其他注意事项'
        }
      ],

      // 添加个人详情
      mediEducationdataInfo: {
        id: '',
        Recordingdate: '',
        Reason: [],
        OtherPrecations: ''
      },
      // 用药情况列表
      SaveMedicationEducationndataOrdersList: [],
      // 用药情况列表表头
      SaveMedicationEducationndataOrdersListHead: [
        {
          operate: ['编辑', '删除'],
          label: '操作',
          link: true,
          width: '100px'
        }, {
          prop: 'ordername',
          label: '药品名称/商品名'
        }, {
          prop: 'usagedosage',
          label: '用法用量'
        }, {
          prop: 'startdate',
          label: '开嘱时间'
        }, {
          prop: 'carematter',
          label: '注意事项'
        }

      ],
      // 药品信息
      MedicationInfoVisible: false,
      MedicationInfo: {
        carematter: '',
        ordername: '',
        startdate: '',
        usagedosage: '',
        SingleDose: '', // 单次剂量
        Administrationunit: '', // 给药单位
        Routeofadministration: '', // 给药途径
        AdministrationFrequency: '' // 给药频次
      },
      // 用药教育 ===========================================
      // 弹窗数据
      getMediEducationListdataInfo: {
        Userid: '', // 系统
        UserName: '', // 系统
        Patient_id: '', // patientDetail.patient_id
        Visit_id: '', // patientDetail.visit_id
        Deptcode: '', // patientDetail.deptcode
        Deptname: '', // patientDetail.deptname
        Patient_name: '', // patientDetail.patient_name
        Inpno: '', // 住院号 patientDetail.inp_no
        Sex: '', // 性别♀ ♂ 进行转换
        Age: '', // patientDetail.age
        Birthdate: '', //
        RecordDate: '', // 记录时间
        InpStatus: '', //  传1或者2   1是入院MR  2是转科MR
        Id: '',
        DrugAllergy: '', // 是否过敏史   1有 0无
        DrugAllergyText: '', // 过敏史描述

        DrugAdverse: '', //   不良反应   1有0无
        DrugAdverseText: '', //  不良反应描述

        SmokingHistory: '', // 吸烟史  1有0无
        DrinkingHistory: '', //  饮酒史 1有0无
        LiverdiseaseHistory: '', // 肝病史 1有0无
        NephropathyHistory: '', //   肾病史  1有0 无
        Others: '', //   其他
        Remarks: '', //   备注
        Status: ''//   为 整体的状态   1有效  0无效
      },
      // 获取药物重整疾病接口

      DrugDiseaseList: [],
      DrugDiseaseListHead: [{
        operate: ['有效', '无效'],
        label: '操作',
        link: true
      }, {
        prop: 'drugdisstatus',
        label: '状态(1有效0无效)'
      }, {
        prop: 'drugdisname',
        label: '疾病名称'
      }, {
        prop: 'drugdistime',
        label: '疾病时间'
      }, {
        prop: 'drugname',
        label: '药品名称'
      }, {
        prop: 'drugtype',
        label: '类型'
      }, {
        prop: 'drugform',
        label: '剂型'
      }, {
        prop: 'drugspec',
        label: '规格'
      }],
      // 获取非药物重整疾病接口
      DiseaseList: [],
      getPatientDisListHead: [{
        label: '操作',
        operate: ['有效', '无效'],
        link: true
      }, {
        prop: 'disstatus',
        label: '状态(1有效0无效)'
      }, {
        prop: 'disname',
        label: '疾病名称'
      }, {
        prop: 'distime',
        label: '疾病时间'
      }, {
        prop: 'treatdescription',
        label: '治疗描述'
      }, {
        prop: 'treattime',
        label: '治疗时间'
      }],
      //       药师评估和建议直接手动填入内容
      EvaluationList: [],
      evaluationListInfo: {
        evaluationstatus: '1',
        evaluationtime: '',
        medicationproblems: '',
        problemanalysis: '',
        mrproposal: '',
        result: ''
      },
      evaluationListInfoVisible: false,
      EvaluationListHead: [
        {
          operate: ['有效', '无效'],
          label: '操作',
          link: true
        }, {
          prop: 'evaluationstatus',
          label: '状态(1有效0无效)'
        }, {
          prop: 'evaluationtime',
          label: '评估时间'
        }, {
          prop: 'medicationproblems',
          label: '用药问题'
        }, {
          prop: 'problemanalysis',
          label: '问题分析'
        }, {
          prop: 'mrproposal',
          label: 'MR建议'
        }, {
          prop: 'result',
          label: '结果'
        }
      ],
      // GetDrugRecombination
      getDrugRecombinationFlag: '新增',
      getDrugRecombinationVisible: false
    }
  },
  watch: {
    patientDetailFather(val, oldVal) {
      this.patientDetail = val
      this.showpatientOrdersdata()
    }
  },
  methods: {
    showevaluationListInfoVisible() {
      this.evaluationListInfoVisible = true
    },
    closeevaluationListInfoVisible() {
      this.evaluationListInfoVisible = false
      this.evaluationListInfo = {
        evaluationstatus: '1',
        evaluationtime: '',
        medicationproblems: '',
        problemanalysis: '',
        mrproposal: '',
        result: ''
      }
    },
    saveevaluationListInfoVisible() {
      this.EvaluationList.push(this.evaluationListInfo)
      this.closeevaluationListInfoVisible()
    },
    // 显示药物重整信息
    showDrugRecombinationVisible() {
      this.GetDrugRecombination()
    },
    closeDrugRecombinationVisible() {
      this.getDrugRecombinationVisible = false
      this.getMediEducationListdataInfo = {
        Userid: '', // 系统
        UserName: '', // 系统
        Patient_id: '', // patientDetail.patient_id
        Visit_id: '', // patientDetail.visit_id
        Deptcode: '', // patientDetail.deptcode
        Deptname: '', // patientDetail.deptname
        Patient_name: '', // patientDetail.patient_name
        Inpno: '', // 住院号 patientDetail.inp_no
        Sex: '', // 性别♀ ♂ 进行转换
        Age: '', // patientDetail.age
        Birthdate: '', //
        RecordDate: '', // 记录时间
        InpStatus: '', //  传1或者2   1是入院MR  2是转科MR
        Id: '',
        DrugAllergy: '', // 是否过敏史   1有 0无
        DrugAllergyText: '', // 过敏史描述

        DrugAdverse: '', //   不良反应   1有0无
        DrugAdverseText: '', //  不良反应描述

        SmokingHistory: '', // 吸烟史  1有0无
        DrinkingHistory: '', //  饮酒史 1有0无
        LiverdiseaseHistory: '', // 肝病史 1有0无
        NephropathyHistory: '', //   肾病史  1有0 无
        Others: '', //   其他
        Remarks: '', //   备注
        Status: ''//   为 整体的状态   1有效  0无效
      }
      this.DrugDiseaseList = []
      this.DiseaseList = []
      this.EvaluationList = []
    },
    // 获取药物重整信息
    async GetDrugRecombination() {
      await GetDrugRecombination({
        json: {
          Userid: this.Userid,
          Username: this.Username,
          Patient_id: this.patientDetail.patient_id,
          Visit_id: this.patientDetail.visit_id,
          Deptcode: this.patientDetail.deptcode
        }
      }).then(res => {
        if (res.MediEducationListdata.length === 0) {
          this.getDrugRecombinationFlag = '新增'
        } else {
          this.getDrugRecombinationFlag = '修改'
          const MediEducationListdata = res.MediEducationListdata[0]
          this.getMediEducationListdataInfo.Patient_id = MediEducationListdata.patient_id
          this.getMediEducationListdataInfo.Id = MediEducationListdata.id
          this.getMediEducationListdataInfo.Visit_id = MediEducationListdata.visit_id
          this.getMediEducationListdataInfo.Deptcode = MediEducationListdata.deptcode
          this.getMediEducationListdataInfo.Deptname = MediEducationListdata.deptname
          this.getMediEducationListdataInfo.Patient_name = MediEducationListdata.patientname
          this.getMediEducationListdataInfo.Inpno = MediEducationListdata.inpno
          this.getMediEducationListdataInfo.Sex = MediEducationListdata.sex
          this.getMediEducationListdataInfo.Age = MediEducationListdata.age
          this.getMediEducationListdataInfo.Birthdate = MediEducationListdata.birthdate
          this.getMediEducationListdataInfo.RecordDate = MediEducationListdata.recorddate
          this.getMediEducationListdataInfo.InpStatus = MediEducationListdata.inpstatus
          this.getMediEducationListdataInfo.DrugAllergy = MediEducationListdata.drugallergy
          this.getMediEducationListdataInfo.DrugAllergyText = MediEducationListdata.drugallergytext === null ? '' : MediEducationListdata.drugallergytext
          this.getMediEducationListdataInfo.DrugAdverse = MediEducationListdata.drugadverse
          this.getMediEducationListdataInfo.DrugAdverseText = MediEducationListdata.drugadversetext === null ? '' : MediEducationListdata.drugadversetext
          this.getMediEducationListdataInfo.SmokingHistory = MediEducationListdata.smokinghistory
          this.getMediEducationListdataInfo.DrinkingHistory = MediEducationListdata.drinkinghistory
          this.getMediEducationListdataInfo.LiverdiseaseHistory = MediEducationListdata.liverdiseasehistory
          this.getMediEducationListdataInfo.NephropathyHistory = MediEducationListdata.nephropathyhistory
          this.getMediEducationListdataInfo.Others = MediEducationListdata.others
          this.getMediEducationListdataInfo.Remarks = MediEducationListdata.remarks
          for (var i = 0; i < res.DrugDisListdata.length; i++) {
            var item = res.DrugDisListdata[i]
            item.drugdisstatus = '1'
            this.DrugDiseaseList.push(item)
          }
          for (var j = 0; j < res.DisListdata.length; j++) {
            var item1 = res.DisListdata[j]
            item1.disstatus = '1'
            this.DiseaseList.push(item1)
          }
          for (var m = 0; m < res.EvaluationListdata.length; m++) {
            var item2 = res.EvaluationListdata[m]
            item2.evaluationstatus = '1'
            this.EvaluationList.push(item2)
          }
        }
        this.getDrugRecombinationVisible = true
      }).catch(err => {
        console.log(err)
      })
    },
    // SaveDrugRecombination
    async SaveDrugRecombination() {
      if (this.getDrugRecombinationFlag === '新增') {
        var DrugDiseaseListTempAdd = []
        for (var aAdd = 0; a < this.DrugDiseaseList.length; aAdd++) {
          var itemDdl = {
            DrugDisname: this.DrugDiseaseList[aAdd].drugdisname,
            DrugDistime: this.DrugDiseaseList[aAdd].drugdistime,
            Drugname: this.DrugDiseaseList[aAdd].drugname,
            Drugtype: this.DrugDiseaseList[aAdd].drugtype,
            Drugform: this.DrugDiseaseList[aAdd].drugform,
            Drugspec: this.DrugDiseaseList[aAdd].drugspec,
            DrugDisStatus: this.DrugDiseaseList[aAdd].drugdisstatus
          }
          DrugDiseaseListTempAdd.push(itemDdl)
        }
        //
        var DiseaseListTempAdd = []
        for (var jAdd = 0; jAdd < this.DiseaseList.length; jAdd++) {
          var itemDl = {
            Disname: this.DiseaseList[jAdd].disname,
            Distime: this.DiseaseList[jAdd].distime,
            TreatDescription: this.DiseaseList[jAdd].treatdescription,
            Treattime: this.DiseaseList[jAdd].treattime,
            DisStatus: this.DiseaseList[jAdd].disstatus
          }
          DiseaseListTempAdd.push(itemDl)
        }
        //
        var EvaluationListTempAdd = []
        for (var xAdd = 0; xAdd < this.EvaluationList.length; xAdd++) {
          var itemEl = {
            Evaluationtime: this.EvaluationList[xAdd].evaluationtime,
            MedicationProblems: this.EvaluationList[xAdd].medicationproblems,
            ProblemAnalysis: this.EvaluationList[xAdd].problemanalysis,
            MrProposal: this.EvaluationList[xAdd].mrproposal,
            Result: this.EvaluationList[xAdd].result,
            EvaluationStatus: this.EvaluationList[xAdd].evaluationstatus
          }
          EvaluationListTempAdd.push(itemEl)
        }
        var jsonTempAdd = {
          Userid: this.Userid,
          Username: this.Username,
          Status: '1',
          Deptcode: this.getMediEducationListdataInfo.Deptcode,
          Deptname: this.getMediEducationListdataInfo.Deptname,
          Patient_name: this.getMediEducationListdataInfo.Patient_name,
          RecordDate: this.getMediEducationListdataInfo.RecordDate,
          Inpno: this.getMediEducationListdataInfo.Inpno,
          InpStatus: this.getMediEducationListdataInfo.InpStatus,
          Sex: this.getMediEducationListdataInfo.Sex,
          Birthdate: this.getMediEducationListdataInfo.Birthdate,
          Age: this.getMediEducationListdataInfo.Age,
          DrugAllergy: this.getMediEducationListdataInfo.DrugAllergy,
          DrugAllergyText: this.getMediEducationListdataInfo.DrugAllergyText,
          DrugAdverse: this.getMediEducationListdataInfo.DrugAdverse,
          DrugAdverseText: this.getMediEducationListdataInfo.DrugAdverseText,
          SmokingHistory: this.getMediEducationListdataInfo.SmokingHistory,
          DrinkingHistory: this.getMediEducationListdataInfo.DrinkingHistory,
          LiverdiseaseHistory: this.getMediEducationListdataInfo.LiverdiseaseHistory,
          NephropathyHistory: this.getMediEducationListdataInfo.NephropathyHistory,
          Others: this.getMediEducationListdataInfo.Others,
          Remarks: this.getMediEducationListdataInfo.Remarks,
          DrugDiseaseList: DrugDiseaseListTempAdd,
          DiseaseList: DiseaseListTempAdd,
          EvaluationList: EvaluationListTempAdd
        }
        axios({
          method: 'post',
          headers: { 'Content-Type': 'application/json' },
          url: 'http://yuwenbincl.xicp.net:15888/PatientManage/GuardianshipList/SaveDrugRecombination',
          data: {
            json: jsonTempAdd
          },
          success: function(res) {
          },
          fail: function(err) {
          }
        })
      } else if (this.getDrugRecombinationFlag === '修改') {
        var DrugDiseaseListTemp = []
        for (var a = 0; a < this.DrugDiseaseList.length; a++) {
          var item = {
            DrugDisId: this.DrugDiseaseList[a].drugdisid,
            DrugDisname: this.DrugDiseaseList[a].drugdisname,
            DrugDistime: this.DrugDiseaseList[a].drugdistime,
            Drugname: this.DrugDiseaseList[a].drugname,
            Drugtype: this.DrugDiseaseList[a].drugtype,
            Drugform: this.DrugDiseaseList[a].drugform,
            Drugspec: this.DrugDiseaseList[a].drugspec,
            DrugDisStatus: this.DrugDiseaseList[a].drugdisstatus
          }
          DrugDiseaseListTemp.push(item)
        }
        //
        var DiseaseListTemp = []
        for (var j = 0; j < this.DiseaseList.length; j++) {
          var item1 = {
            DisId: this.DiseaseList[j].disid,
            Disname: this.DiseaseList[j].disname,
            Distime: this.DiseaseList[j].distime,
            TreatDescription: this.DiseaseList[j].treatdescription,
            Treattime: this.DiseaseList[j].treattime,
            DisStatus: this.DiseaseList[j].disstatus
          }
          DiseaseListTemp.push(item1)
        }
        //
        var EvaluationListTemp = []
        for (var x = 0; x < this.EvaluationList.length; x++) {
          var item2 = {
            EvaluationId: this.EvaluationList[x].evaluationid,
            Evaluationtime: this.EvaluationList[x].evaluationtime,
            MedicationProblems: this.EvaluationList[x].medicationproblems,
            ProblemAnalysis: this.EvaluationList[x].problemanalysis,
            MrProposal: this.EvaluationList[x].mrproposal,
            Result: this.EvaluationList[x].result,
            EvaluationStatus: this.EvaluationList[x].evaluationstatus
          }
          EvaluationListTemp.push(item2)
        }
        var jsonTemp = {
          Userid: this.Userid,
          Username: this.Username,
          Id: this.getMediEducationListdataInfo.Id,
          Status: '1',
          Deptcode: this.getMediEducationListdataInfo.Deptcode,
          Deptname: this.getMediEducationListdataInfo.Deptname,
          Patient_name: this.getMediEducationListdataInfo.Patient_name,
          RecordDate: this.getMediEducationListdataInfo.RecordDate,
          Inpno: this.getMediEducationListdataInfo.Inpno,
          InpStatus: this.getMediEducationListdataInfo.InpStatus,
          Sex: this.getMediEducationListdataInfo.Sex,
          Birthdate: this.getMediEducationListdataInfo.Birthdate,
          Age: this.getMediEducationListdataInfo.Age,
          DrugAllergy: this.getMediEducationListdataInfo.DrugAllergy,
          DrugAllergyText: this.getMediEducationListdataInfo.DrugAllergyText,
          DrugAdverse: this.getMediEducationListdataInfo.DrugAdverse,
          DrugAdverseText: this.getMediEducationListdataInfo.DrugAdverseText,
          SmokingHistory: this.getMediEducationListdataInfo.SmokingHistory,
          DrinkingHistory: this.getMediEducationListdataInfo.DrinkingHistory,
          LiverdiseaseHistory: this.getMediEducationListdataInfo.LiverdiseaseHistory,
          NephropathyHistory: this.getMediEducationListdataInfo.NephropathyHistory,
          Others: this.getMediEducationListdataInfo.Others,
          Remarks: this.getMediEducationListdataInfo.Remarks,
          DrugDiseaseList: DrugDiseaseListTemp,
          DiseaseList: DiseaseListTemp,
          EvaluationList: EvaluationListTemp
        }
        axios({
          method: 'post',
          url: 'http://yuwenbincl.xicp.net:15888/PatientManage/GuardianshipList/SaveDrugRecombination',
          param: {
            json: jsonTemp
          },
          headers: { 'Content-Type': 'multipart/form-data' },
          success: function(res) {
            // 不走

          },
          //
          fail: function(err) {

          }
        }).then(res => {

          this.closeDrugRecombinationVisible()
        }).catch(err => {
        })

        // axios.post('http://yuwenbincl.xicp.net:15888/PatientManage/GuardianshipList/SaveDrugRecombination',
        //   {
        //     json: tempJson
        //   },
        //   {
        //     headers: { 'Content-Type': 'multipart/form-data' }
        //   }
        // ).then(res => {
        //   console.log('res')
        //   console.log(res)
        //   this.closeDrugRecombinationVisible()
        // }).catch(err => {
        //   console.log('err')
        //   console.log(err)
        // })

        // axios.post('',
        //   json:tempJson,
        //   {
        //     headers: { 'Content-Type': 'multipart/form-data' }
        //   }
        // )
        // await SaveDrugRecombination({
        //   json: jsonTemp
        // }).then(res => {
        //   console.log('res')
        //   console.log(res)
        //   this.closeDrugRecombinationVisible()
        // }).catch(err => {
        //   console.log('err')
        //   console.log(err)
        // })
      }
    },
    async deleteSaveDrugRecombination() {
      await SaveDrugRecombination({
        json: {
          Userid: this.Userid,
          Username: this.Username,
          Id: this.getMediEducationListdataInfo.Id,
          Status: '0'
        }
      }).then(res => {
        this.closeDrugRecombinationVisible()
      }).catch(err => {
        console.log(err)
      })
    },
    operateClickDrugDiseaseList(val, row) {
      var ddl = 0
      for (ddl = 0; ddl < this.DrugDiseaseList.length; ddl++) {
        if (row === this.DrugDiseaseList[ddl]) {
          if (val === '有效') {
            row.drugdisstatus = '1'
          } else {
            row.drugdisstatus = '0'
          }
          break
        }
      }
      this.DrugDiseaseList.splice(ddl, 1, row)
    },
    operateClickDiseaseList(val, row) {
      var dl = 0
      for (dl = 0; dl < this.DiseaseList.length; dl++) {
        if (row === this.DiseaseList[dl]) {
          if (val === '有效') {
            row.disstatus = '1'
          } else {
            row.disstatus = '0'
          }
          break
        }
      }
      this.DrugDiseaseList.splice(dl, 1, row)
    },
    operateClickEvaluationList(val, row) {
      var el = 0
      for (el = 0; el < this.EvaluationList.length; el++) {
        if (row === this.EvaluationList[el]) {
          if (val === '有效') {
            row.evaluationstatus = '1'
          } else {
            row.evaluationstatus = '0'
          }
          break
        }
      }
      this.EvaluationList.splice(el, 1, row)
    },
    handlePatientDrugDisListdata(data) {
      for (var i = 0; i < data.length; i++) {
        const item = {
          drugdisname: data[i].disname,
          drugdisstatus: '1',
          drugdistime: data[i].distime,
          drugform: data[i].drugform,
          drugname: data[i].itemname,
          drugspec: data[i].drugspec,
          drugtype: data[i].drugtype
        }
        this.DrugDiseaseList.push(item)
      }
    },
    handlePatientDisListdata(data) {
      for (var i = 0; i < data.length; i++) {
        const item = {
          disname: data[i].disname,
          disstatus: '1',
          distime: data[i].distime,
          treatdescription: data[i].treatdescription,
          treattime: data[i].treattime
        }
        this.DiseaseList.push(item)
      }
    },
    handleCurrentPatientOrdersList(data) {
      for (var i = 0; i < data.length; i++) {
        this.SaveMedicationEducationndataOrdersList.push(data[i])
      }
    },
    // 用药教育=====================================
    // 1. 用药教育主界面打开
    showMediEducationdataDialog() {
      // 获取用药教育列表
      this.GetMediEducationdata()
      this.MediEducationListdataMainVisible = true
    },
    // 2. 用药教育主界面关闭
    closeMediEducationdataDialog() {
      this.MediEducationListdataMainVisible = false
    },
    // 获取用药教育列表
    async GetMediEducationdata() {
      this.MediEducationListdata = []
      await GetMediEducationdata({
        json: {
          Userid: this.Userid,
          Patient_id: this.patientDetail.patient_id,
          Visit_id: this.patientDetail.visit_id,
          Deptcode: this.patientDetail.deptcode,
          Type: '1'
        }
      }).then(res => {
        this.MediEducationListdata = res.MediEducationListdata
      }).catch(err => {
        console.log(err)
      })
    },
    // 获取用药教育个人列表
    async GetMediEducationdataInfo() {
      await GetMediEducationdata({
        json: {
          Userid: this.Userid,
          Patient_id: this.patientDetail.Patient_id,
          Visit_id: this.patientDetail.Visit_id,
          Deptcode: this.patientDetail.Deptcode,
          Type: '2',
          Id: this.mediEducationdataInfo.id
        }
      }).then(res => {
        this.SaveMedicationEducationndataOrdersList = res.MediEducationListdata
      }).catch(err => {
        console.log(err)
      })
    },
    // 用药教育操作查看
    operateClickMediEducationListdata(val, row) {
      this.mediEducationdataInfo = {
        id: row.id,
        Recordingdate: row.recordingdate,
        Reason: row.reason.split(','),
        OtherPrecations: row.otherprecautions
      }
      if (val === '修改') {
        this.MediEducationListdataHeadFlag = '修改'
        this.GetMediEducationdataInfo()
        this.showSaveMedicationEducationndataVisibleDialog()
      } else if (val === '删除') {
        this.MediEducationListdataHeadFlag = '删除'
        this.addSaveMedicationEducationndataApi()
      }

      // this.mediEducationdataInfo = {
      //   id: row.id,
      //   Recordingdate: row.recordingdate,
      //   Reason: row.reason.split(','),
      //   OtherPrecations: row.otherprecautions
      // }
      // this.GetMediEducationdataInfo()
      // this.showSaveMedicationEducationndataVisibleDialog()
    },
    operateClickMedicationEducationndataOrdersList(val, row) {
      if (val === '编辑') {
        this.MedicationInfo.carematter = row.carematter
        this.MedicationInfo.ordername = row.ordername
        this.MedicationInfo.startdate = row.startdate
        this.MedicationInfo.usagedosage = row.usagedosage
        this.showMedicationInfoVisible()
      } else if (val === '删除') {
        for (var i = 0; i < this.SaveMedicationEducationndataOrdersList.length; i++) {
          if (this.SaveMedicationEducationndataOrdersList[i].ordername === row.ordername) {
            this.SaveMedicationEducationndataOrdersList.splice(i, 1)
            break
          }
        }
      }
    },
    // 显示药品信息
    showMedicationInfoVisible() {
      this.MedicationInfoVisible = true
    },
    // 关闭药品信息
    closeMedicationInfoVisible() {
      this.MedicationInfoVisible = false
      this.MedicationInfo = {
        carematter: '',
        ordername: '',
        startdate: '',
        usagedosage: '',
        SingleDose: '', // 单次剂量
        Administrationunit: '', // 给药单位
        Routeofadministration: [], // 给药途径
        AdministrationFrequency: '' // 给药频次
      }
    },
    // 保存
    saveMedicationInfoVisible() {
      this.MedicationInfo.usagedosage = this.MedicationInfo.SingleDose +
        this.MedicationInfo.Administrationunit +
        this.MedicationInfo.Routeofadministration +
        this.MedicationInfo.AdministrationFrequency
      for (var i = 0; i < this.SaveMedicationEducationndataOrdersList.length; i++) {
        if (this.SaveMedicationEducationndataOrdersList[i].ordername === this.MedicationInfo.ordername) {
          this.SaveMedicationEducationndataOrdersList[i].ordername = this.MedicationInfo.ordername
          this.SaveMedicationEducationndataOrdersList[i].carematter = this.MedicationInfo.carematter
          this.SaveMedicationEducationndataOrdersList[i].startdate = this.MedicationInfo.startdate
          this.SaveMedicationEducationndataOrdersList[i].usagedosage = this.MedicationInfo.usagedosage
          this.closeMedicationInfoVisible()
          break
        }
      }
    },
    handleMedicationRoutecode(data) {
      var names = []
      for (var i = 0; i < data.length; i++) {
        names.push(data[i].routename)
      }
      this.MedicationInfo.Routeofadministration = names.join(',')
    },
    // 3.点击查看显示个人信息弹窗
    // 用药教育详情打卡
    showSaveMedicationEducationndataVisibleDialog() {
      this.mediEducationdataInfoInfoVisible = true
    },
    // 用药教育详情关闭
    closeSaveMedicationEducationndataVisibleDialog() {
      this.mediEducationdataInfoInfoVisible = false
      this.SaveMedicationEducationndataOrdersList = []
      this.GetMediEducationdata()
    },
    // 新增用药教育
    addSaveMedicationEducationndata() {
      this.MediEducationListdataHeadFlag = '新增'
      this.mediEducationdataInfo = {
        id: '',
        Recordingdate: '',
        Reason: [],
        OtherPrecations: ''
      }
      this.showSaveMedicationEducationndataVisibleDialog()
    },
    async addSaveMedicationEducationndataApi() {
      const tempOrderList = []
      for (var i = 0; i < this.SaveMedicationEducationndataOrdersList.length; i++) {
        const temp = {
          Ordername: this.SaveMedicationEducationndataOrdersList[i].ordername,
          Usagedosage: this.SaveMedicationEducationndataOrdersList[i].usagedosage,
          Startdate: this.SaveMedicationEducationndataOrdersList[i].startdate,
          Carematter: this.SaveMedicationEducationndataOrdersList[i].carematter,
          Status: '1'
        }
        tempOrderList[i] = temp
      }
      const tempJson = {
        Userid: this.Userid,
        Username: this.Username,
        Patient_id: this.patientDetail.patient_id,
        Visit_id: this.patientDetail.visit_id,
        Deptcode: this.patientDetail.deptcode,
        Deptname: this.patientDetail.deptname,
        Recordingdate: this.mediEducationdataInfo.Recordingdate,
        Reason: this.mediEducationdataInfo.Reason.join(','),
        OtherPrecations: this.mediEducationdataInfo.OtherPrecations,
        Status: '1',
        OrdersList: tempOrderList
      }
      if (tempOrderList.length === 0) {
        delete tempJson.OrdersList
      }
      if (this.MediEducationListdataHeadFlag === '删除') {
        tempJson.Id = this.mediEducationdataInfo.id
        tempJson.Status = '0'
      } else if (this.MediEducationListdataHeadFlag === '修改') {
        tempJson.id = this.mediEducationdataInfo.id
      } else if (this.MediEducationListdataHeadFlag === '新增') {

      }
      await SaveMedicationEducationndata({
        json: tempJson
      }).then(res => {
        if (res === '保存成功') {
          this.$message({
            message: '保存成功',
            type: 'success'
          })
        }
      }).catch(err => {
        console.log(err)
      })
      this.closeSaveMedicationEducationndataVisibleDialog()
      this.MediEducationListdataHeadFlag = '新增'
    },
    // 打印
    printfInfo() {
      const subOutputRankPrint = document.getElementById('printcontent')
      const newContent = subOutputRankPrint.innerHTML
      const oldContent = document.body.innerHTML
      document.body.innerHTML = newContent
      window.print()
      window.location.reload()
      document.body.innerHTML = oldContent
      // let bdhtml = window.document.body.innerHTML
      // let sprnstr = '<!--startprint-->' // 开始打印标识字符串有17个字符
      // let eprnstr = '<!--endprint-->' // 结束打印标识字符串
      // let prnhtml = bdhtml.substr(bdhtml.indexOf(sprnstr) + 17) // 从开始打印标识之后的内容
      // let prnhtmls = prnhtml.substring(0, prnhtml.indexOf(eprnstr)) // 截取开始标识和结束标识之间的内容
      // window.document.body.innerHTML = prnhtmls // 把需要打印的指定内容赋给body.innerHTML
      // window.document.body.innerHTML = prnhtml // 把需要打印的指定内容赋给body.innerHTML
      // window.print() // 调用浏览器的打印功能打印指定区域
      // window.document.body.innerHTML = bdhtml// 重新给页面内容赋值；
      // window.location.reload()
      return false
    },
    // 用药教育=====================================
    // 用药咨询==============================
    // 显示用药咨询
    showMedicationConsultationDialog() {
      this.medicationConsultationDialog = true
    },
    // 关闭用药咨询
    closeMedicationConsultationDialog() {
      this.medicationConsultationDialog = false
      this.clearQueryMedicationConsultationObj()
    },
    // 咨询对象
    handleConsultationObject(data) {
      var names = []
      for (var i = 0; i < data.length; i++) {
        names.push(data[i].drugname)
      }
      if (this.addMedicationConsultationDialog) {
        this.medicationConsultationDialogObj.ConsultationObject = names.join(',')
      } else {
        this.queryMedicationConsultationObj.ConsultationObject = names.join(',')
      }
    },
    // 科室
    handleDeptcode(data) {
      var names = []
      for (var i = 0; i < data.length; i++) {
        names.push(data[i].deptname)
      }
      this.medicationConsultationDialogObj.ConsultantDept = names.join(',')
    },
    // 按钮查询
    btnMedicationConsultationdata() {
      this.queryMedicationConsultationPage = {
        pagesize: 10,
        pagenum: 1,
        total: 0
      }
      this.getMedicationConsultationdata()
    },
    // 分页查询
    pageMedicationConsultationdata(type) {
      this.queryMedicationConsultationPage.pagenum = type.page
      this.queryMedicationConsultationPage.pagesize = type.limit
      this.getMedicationConsultationdata()
    },
    // 获取分页数据
    async getMedicationConsultationdata() {
      this.MedicationConsultationListdata = []
      const tempJson = {
        Patient_id: this.patientDetail.patient_id,
        Visit_id: this.patientDetail.visit_id,
        ConsultationObject: this.queryMedicationConsultationObj.ConsultationObject,
        Inputuser: this.queryMedicationConsultationObj.Inputuser,
        Problems: this.queryMedicationConsultationObj.Problems,
        ConsultationType: this.queryMedicationConsultationObj.ConsultationType.join(',')
      }
      await getMedicationConsultationdata({
        pagesize: this.queryMedicationConsultationPage.pagesize,
        pagenum: this.queryMedicationConsultationPage.pagenum,
        json: tempJson
      }).then(res => {
        this.MedicationConsultationListdata = res.MedicationConsultationListdata
        this.queryMedicationConsultationPage.total = res.records
      }).catch(err => {
        console.log(err)
      })
    },
    // 重置
    clearQueryMedicationConsultationObj() {
      this.queryMedicationConsultationObj = {
        ConsultationObject: '',
        Inputuser: '',
        Problems: '',
        ConsultationType: []
      }
      this.queryMedicationConsultationPage = {
        pagesize: 10,
        pagenum: 1,
        total: 0
      }
    },
    // 新增用药咨询
    // 显示弹窗
    showaAddMedicationConsultation() {
      this.addMedicationConsultationDialog = true
    },
    // 关闭弹窗
    closeAddMedicationConsultation() {
      this.changeMedicationConsultationObjDialog = false
      this.addMedicationConsultationDialog = false
      this.medicationConsultationDialogObj = {
        ConsultationDate: '',
        ConsultantStatus: '',
        ConsultantDept: '',
        ConsultantIdentity: '',
        ConsultantName: '',
        ConsultationObject: '',
        ConsultationType: [],
        ConcreteProblems: '',
        PharmacistAnswers: '',
        ConsultationResult: ''
      }
      this.changeMedicationConsultationObj = {
        concreteproblems: '',
        consultationdate: '',
        drugname: '',
        inputuser: '',
        pharmacistanswers: ''
      }
    },
    // 保存更新删除弹窗操作
    saveMedicationConsultation() {
      this.optVal = '新增'
      this.saveMedicationConsultationdata()
    },
    operateClickMedicationConsultationdata(val, row) {
      this.rowId = row.id
      this.changeMedicationConsultationObj.concreteproblems = row.concreteproblems
      this.changeMedicationConsultationObj.consultationdate = row.consultationdate
      this.changeMedicationConsultationObj.drugname = row.drugname
      this.changeMedicationConsultationObj.inputuser = row.inputuser
      this.changeMedicationConsultationObj.pharmacistanswers = row.pharmacistanswers
      if (val === '删除') {
        this.optVal = '删除'
        this.saveMedicationConsultationdata()
      } else if (val === '修改') {
        this.optVal = '修改'
        this.changeMedicationConsultationObjDialog = true
      }
    },
    // 弹窗接口
    async saveMedicationConsultationdata() {
      let tempJson = {}
      if (this.optVal === '新增') {
        tempJson = {
          Userid: this.Userid,
          Username: this.Username,
          Patient_id: this.patientDetail.patient_id,
          Visit_id: this.patientDetail.visit_id,
          ConsultationDate: this.medicationConsultationDialogObj.ConsultationDate,
          ConsultantStatus: this.medicationConsultationDialogObj.ConsultantStatus,
          ConsultantDept: this.medicationConsultationDialogObj.ConsultantDept,
          ConsultantIdentity: this.medicationConsultationDialogObj.ConsultantIdentity,
          ConsultantName: this.medicationConsultationDialogObj.ConsultantName,
          ConsultationObject: this.medicationConsultationDialogObj.ConsultationObject,
          ConsultationType: this.medicationConsultationDialogObj.ConsultationType.join(','),
          ConcreteProblems: this.medicationConsultationDialogObj.ConcreteProblems,
          PharmacistAnswers: this.medicationConsultationDialogObj.PharmacistAnswers,
          ConsultationResult: this.medicationConsultationDialogObj.ConsultationResult,
          Status: '1' }
      } else if (this.optVal === '删除') {
        tempJson = {
          Userid: this.Userid,
          Username: this.Username,
          Id: this.rowId,
          ConcreteProblems: this.changeMedicationConsultationObj.ConcreteProblems,
          ConsultationDate: this.changeMedicationConsultationObj.ConsultationDate,
          ConsultationObject: this.changeMedicationConsultationObj.ConsultationObject,
          PharmacistAnswers: this.changeMedicationConsultationObj.PharmacistAnswers,
          Status: '0' }
      } else if (this.optVal === '修改') {
        tempJson = {
          Userid: this.Userid,
          Username: this.Username,
          Id: this.rowId,
          ConcreteProblems: this.changeMedicationConsultationObj.concreteproblems,
          ConsultationDate: this.changeMedicationConsultationObj.consultationdate,
          ConsultationObject: this.changeMedicationConsultationObj.drugname,
          PharmacistAnswers: this.changeMedicationConsultationObj.pharmacistanswers,
          Status: '1' }
      }
      await saveMedicationConsultationdata({
        json: tempJson
      }).then(res => {
        if (res === '保存成功') {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
        } else {
          this.$message({
            message: res,
            type: 'warning'
          })
        }
        this.closeAddMedicationConsultation()
        this.getMedicationConsultationdata()
        this.optVal = '新增'
        this.rowId = ''
      }).catch(err => {
        console.log(err)
      })
    },
    // 用药咨询==============================

    // 简要记录 =================================
    // 显示简要记录弹窗
    showSummaryRecordDataDialog() {
      this.summaryRecordDataPage = {
        pagesize: 10,
        pagenum: 1,
        total: 0
      }
      this.getSummaryRecorddata()
      this.summaryRecordDataDialog = true
    },
    // 关闭简要记录弹窗
    closeSummaryRecordDataDialog() {
      this.summaryRecordDataDialog = false
    },
    // 简要记录 新增弹窗显示
    showAddSummaryRecordDataDialog() {
      this.optVal = '新增'
      this.addSummaryRecordDataDialog = true
    },
    // 简要记录 新增弹窗关闭
    closeAddSummaryRecordDataDialog() {
      this.getSummaryRecorddata()
      this.addSummaryRecordDataDialog = false
      this.changeSummaryRecordDataDialog = false
      this.summaryRecordObj = {
        RecordDate: '',
        RecordType: [],
        RecordObject: '',
        RecordContent: ''
      }
    },
    // 保存新增简要记录
    async saveAddSummaryRecordDataDialog() {
      let tempJson = {}
      if (this.optVal === '新增') {
        tempJson = {
          Userid: this.Userid,
          Username: this.Username,
          Patient_id: this.patientDetail.patient_id,
          Visit_id: this.patientDetail.visit_id,
          Deptcode: this.patientDetail.deptcode,
          // Deptcode: '00191',
          Deptname: this.patientDetail.deptname,
          RecordDate: this.summaryRecordObj.RecordDate,
          RecordType: this.summaryRecordObj.RecordType,
          RecordObject: this.summaryRecordObj.RecordObject,
          RecordContent: this.summaryRecordObj.RecordContent,
          Status: '1'
        }
      } else if (this.optVal === '删除') {
        tempJson = {
          Userid: this.Userid,
          Username: this.Username,
          Id: this.rowId,
          RecordDate: this.summaryRecordObj.RecordDate,
          RecordType: this.summaryRecordObj.RecordType,
          RecordObject: this.summaryRecordObj.RecordObject,
          RecordContent: this.summaryRecordObj.RecordContent,
          Status: '0'
        }
      } else if (this.optVal === '修改') {
        tempJson = {
          Userid: this.Userid,
          Username: this.Username,
          Id: this.rowId,
          RecordDate: this.summaryRecordObj.RecordDate,
          RecordType: this.summaryRecordObj.RecordType,
          RecordObject: this.summaryRecordObj.RecordObject,
          RecordContent: this.summaryRecordObj.RecordContent,
          Status: '1'
        }
      }
      await gslSaveSummaryRecorddata({
        json: tempJson
      }).then(res => {
        if (res === '保存成功') {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
        } else {
          this.$message({
            message: res,
            type: 'warning'
          })
        }
        this.closeAddSummaryRecordDataDialog()
        this.getSummaryRecorddata()
        this.optVal = '新增'
        this.rowId = ''
      }).catch(err => {
        console.log(err)
      })
    },
    // 删除/修改
    operateClicksummaryRecordData(val, row) {
      this.rowId = row.id
      this.summaryRecordObj.RecordDate = row.recorddate
      this.summaryRecordObj.RecordType = row.recordtype
      this.summaryRecordObj.RecordObject = row.recordobject
      this.summaryRecordObj.RecordContent = row.recordcontent
      if (val === '修改') {
        this.optVal = '修改'
        this.changeSummaryRecordDataDialog = true
      } else if (val === '删除') {
        this.optVal = '删除'
        this.saveAddSummaryRecordDataDialog()
      }
    },
    // 简要记录 列表数据
    async getSummaryRecorddata() {
      await gslGetSummaryRecorddata({
        json: {
          Patient_id: this.patientDetail.patient_id,
          Visit_id: this.patientDetail.visit_id
        },
        pagenum: this.summaryRecordDataPage.pagenum,
        pagesize: this.summaryRecordDataPage.pagesize
      }).then(res => {
        this.summaryRecordData = res.SummaryRecorddata
        this.summaryRecordDataPage.total = res.records
      }).catch(err => {
        console.log(err)
      })
    },
    // 简要记录 列表数据 分页
    async getSummaryRecorddataList(type) {
      this.summaryRecordDataPage.pagenum = type.page
      this.summaryRecordDataPage.pagesize = type.limit
      await this.getSummaryRecorddata()
    },
    // 简要记录 ==================================

    // 个人医嘱信息 ===========================
    showpatientOrdersdata() {
      this.gslGetPatientOrdersdata()
    },
    // 获取单个病人的医嘱信息
    async gslGetPatientOrdersdata() {
      const tempJson = {
        Patient_id: this.patientDetail.patient_id,
        Visit_id: this.patientDetail.visit_id,
        Ordername: this.queryInfo.Ordername,
        IsTemp: this.queryInfo.IsTemp,
        OrderType: this.queryInfo.OrderType,
        DrugCode: this.queryInfo.DrugCode
      }
      for (var key in tempJson) {
        if (tempJson[key] === '') {
          delete tempJson[key]
        }
      }
      await gslGetPatientOrdersdata({
        json: tempJson,
        pagesize: this.page.pagesize,
        pagenum: this.page.pagenum
      }).then(res => {
        this.patientOrdersdataList = res.patientOrdersdata
      }).catch(err => {
        console.log(err)
      })
    },
    // 选中单条医嘱
    selectionChangepatientOrdersdata(val) {
    },
    // 分页
    async pageGetPatientOrdersdata(type) {
      this.page.pagenum = type.page
      this.page.pagesize = type.limit
      await this.gslGetPatientOrdersdata()
    },
    // 个人医嘱信息 ===========================

    // 监护计划==============================================
    // 显示监护计划弹窗
    showguardianshipPlandata() {
      this.getGuardianshipPlandata()
      this.guardianshipPlandataVisible = true
    },
    // 关闭监护计划
    closegetGuardianshipPlandata() {
      this.guardianshipPlandataVisible = false
      this.guardianshipPlandata = []
      this.planObj = {
        Startdate: '',
        Guardianshipobject: '',
        GuardianshipPoints: '',
        Type: ''
      }
    },
    savegetGuardianshipPlandata() {
      this.closegetGuardianshipPlandata()
    },
    // 获取监护计划
    async getGuardianshipPlandata() {
      this.guardianshipPlandata = []
      var tempJson = {
        Userid: this.Userid,
        Patient_id: this.patientDetail.patient_id,
        Visit_id: this.patientDetail.visit_id,
        Deptcode: this.patientDetail.deptcode
        // Deptcode: '00191'
      }
      await gslGetGuardianshipPlandata({
        json: tempJson
      }).then(res => {
        const guardianshipPlandataTemp = []
        for (let i = 0; i < res.GuardianshipPlandata.length; i++) {
          const item = res.GuardianshipPlandata[i]
          if (item.patient_node === null) {
            item.children = []
            guardianshipPlandataTemp.push(item)
          } else {
            for (var index in item) {
              if (index === 'patient_node') {
                for (let j = 0; j < guardianshipPlandataTemp.length; j++) {
                  if (item[index] === guardianshipPlandataTemp[j].id) {
                    guardianshipPlandataTemp[j].children.push(item)
                  }
                }
              }
            }
          }
        }
        this.guardianshipPlandata = guardianshipPlandataTemp
      }).catch(err => {
        console.log(err)
      })
    },
    // 监护计划和监护过程
    async saveGuardianshipPlandata(opt) {
      let tempObj = {}
      // 增加监护计划
      if (opt === 'addPlan') {
        tempObj = {
          Userid: this.Userid,
          Username: this.Username,
          Patient_id: this.patientDetail.patient_id,
          Visit_id: this.patientDetail.visit_id,
          Deptcode: this.patientDetail.deptcode,
          // Deptcode: '00191',
          Deptname: this.patientDetail.deptname,
          Startdate: this.planObj.Startdate,
          Guardianshipobject: this.planObj.Guardianshipobject,
          GuardianshipPoints: this.planObj.GuardianshipPoints,
          Type: this.planObj.Type
        }
        // 修改监护计划
      } else if (opt === 'editPlan') {
        tempObj = {
          Id: this.planObjId,
          Startdate: this.planObj.Startdate,
          Guardianshipobject: this.planObj.Guardianshipobject,
          GuardianshipPoints: this.planObj.GuardianshipPoints,
          Status: '1'
        }
      } else if (opt === 'delPlan') {
        tempObj = {
          Id: this.planObjId,
          Status: '0'
        }
      } else if (opt === 'saveSonPlan') {
        tempObj = {
          Patient_node: this.planObjId,
          Startdate: this.planObj.Startdate,
          Guardianshipobject: this.planObj.Guardianshipobject,
          GuardianshipPoints: this.planObj.GuardianshipPoints
        }
      }
      await gslSaveGuardianshipPlandata({
        json: tempObj
      }).then(res => {
        if (res === '保存成功') {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
        } else {
          this.$message({
            message: res,
            type: 'warning'
          })
        }
        this.closePlan()
        this.getGuardianshipPlandata()
      }).catch(err => {
        console.log(err)
      })
    },
    // 显示监护计划弹窗
    showaddPlan() {
      this.innerVisible = true
      this.isAddOrEdit = true
    },
    // 保存监护计划
    addPlan() {
      this.saveGuardianshipPlandata('addPlan')
      this.closePlan()
    },
    // 关监护计划弹窗
    closePlan() {
      this.innerVisible = false
      this.isAddOrEdit = true
      this.isShowSonPlan = false
      this.planObj = {
        Startdate: '',
        Guardianshipobject: '',
        GuardianshipPoints: '',
        Type: ''
      }
      this.planObjId = ''
    },
    // 删除监护计划
    delPlan(index, val) {
      this.planObjId = val.id
      this.saveGuardianshipPlandata('delPlan')
    },
    // 显示编辑监护计划
    showEditPlan(index, val) {
      this.planObj.Startdate = val.startdate
      this.planObj.Guardianshipobject = val.guardianshipobject
      this.planObj.GuardianshipPoints = val.guardianshippoints
      this.innerVisible = true
      this.isAddOrEdit = false
      this.planObjId = val.id
    },
    // 编辑监护计划
    editPlan() {
      this.saveGuardianshipPlandata('editPlan')
    },
    // 显示监护过程
    showSonPlan(index, val) {
      this.planObjId = val.id
      this.planObj.Startdate = ''
      this.planObj.Guardianshipobject = ''
      this.planObj.GuardianshipPoints = ''
      this.isShowSonPlan = true
    },
    // 保存监护过程
    saveSonPlan() {
      this.saveGuardianshipPlandata('saveSonPlan')
    },
    // 监护计划==============================================
    // 用药建议 ============================================
    // 显示用药建议弹窗
    showMedicationSuggestionDialog() {
      this.getMedicationSuggestiondata()
      this.medicationSuggestionDialog = true
    },
    // 关闭用药建议弹窗
    closeMedicationSuggestionDialog() {
      this.medicationSuggestionDialog = false
    },
    // 修改删除
    operateClickMedication(val, row) {
      // let tempJson = {}
      // 修改用药建议
      if (val === '修改') {
        this.optVal = '修改'
        this.optId = row.id
        this.medicationSuggestionDataObj = {
          Recordingdate: row.recordingdate,
          SuggestionObject: row.suggestionobject,
          SuggestionPoints: row.suggestionpoints,
          SuggestionType: row.suggestiontype.split(','),
          SuggestionDoctor: row.suggestiondoctor,
          SuggestionStatus: row.suggestionstatus
        }
        this.showAddMedicationSuggestionDialog()
      } else if (val === '删除') {
        // 删除用药建议
        this.optVal = '删除'
        this.optId = row.id
        this.saveMedicationSuggestionDialog(this.optVal)
      }
    },
    async getMedicationSuggestiondata() {
      // const tempJson = {
      //   Userid: this.Userid,
      //   Patient_id: this.patientDetail.patient_id,
      //   Visit_id: this.patientDetail.visit_id,
      //   Deptcode: this.patientDetail.deptcode
      // }
      const tempJson = {
        Userid: this.Userid,
        Patient_id: this.patientDetail.patient_id,
        Visit_id: this.patientDetail.visit_id,
        Deptcode: this.patientDetail.deptcode
      }
      await gslGetMedicationSuggestiondata({
        json: tempJson
      }).then(res => {
        this.medicationSuggestiondata = res.GuardianshipPlandata
      }).catch(err => {
        console.log(err)
      })
    },
    // 新增用药建议弹窗显示
    showAddMedicationSuggestionDialog() {
      this.medicationSuggestion = true
    },
    // 关闭新增用药建议弹窗
    closeAddMedicationSuggestionDialog() {
      this.medicationSuggestion = false
      this.optVal = '新增'
      this.optId = ''
      this.medicationSuggestionDataObj = {
        Recordingdate: '',
        SuggestionObject: '',
        SuggestionPoints: '',
        SuggestionType: [],
        SuggestionDoctor: '',
        SuggestionStatus: ''
      }
      this.getMedicationSuggestiondata()
    },
    // 保存用药建议接口
    async saveMedicationSuggestionDialog(optVal) {
      let tempObj = {}
      if (optVal === '新增') {
        tempObj = {
          Userid: this.Userid,
          Username: this.Username,
          Patient_id: this.patientDetail.patient_id,
          Visit_id: this.patientDetail.visit_id,
          Deptcode: this.patientDetail.deptcode,
          Deptname: this.patientDetail.deptname,
          Recordingdate: this.medicationSuggestionDataObj.Recordingdate,
          SuggestionObject: this.medicationSuggestionDataObj.SuggestionObject,
          SuggestionPoints: this.medicationSuggestionDataObj.SuggestionPoints,
          SuggestionType: this.medicationSuggestionDataObj.SuggestionType.join(','),
          SuggestionDoctor: this.medicationSuggestionDataObj.SuggestionDoctor,
          SuggestionStatus: '1'
        }
      } else if (optVal === '修改') {
        tempObj = {
          Id: this.optId,
          Recordingdate: this.medicationSuggestionDataObj.Recordingdate,
          SuggestionObject: this.medicationSuggestionDataObj.SuggestionObject,
          SuggestionPoints: this.medicationSuggestionDataObj.SuggestionPoints,
          SuggestionType: this.medicationSuggestionDataObj.SuggestionType.join(','),
          SuggestionDoctor: this.medicationSuggestionDataObj.SuggestionDoctor,
          SuggestionStatus: '1' }
      } else if (optVal === '删除') {
        tempObj = {
          Id: this.optId,
          Status: '0'
        }
      }
      await gslSaveMedicationSuggestiondata({
        json: tempObj
      }).then(res => {
        if (res === '保存成功') {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
        }
      }).catch(err => {
        console.log(err)
      })
      this.getMedicationSuggestiondata()
      this.closeAddMedicationSuggestionDialog()
    },
    // 用药建议 ============================================

    // 字典
    selectPop(val) {
      this.$refs.ptable.show()
      this.pType = val
    },
    handleCurrentPatientOrdersListObj(data) {
      var guardianshipobject = []
      for (var i = 0; i < data.length; i++) {
        guardianshipobject.push(data[i].mergedata)
      }
      this.planObj.Guardianshipobject += guardianshipobject.join(',')
    },
    handleCurrentPatientOrdersListPoint(data) {
      var guardianshipPoints = []
      for (var i = 0; i < data.length; i++) {
        guardianshipPoints.push(data[i].mergedata)
      }
      this.planObj.GuardianshipPoints += guardianshipPoints.join(',')
    },
    handleCurrentPatientLabdata(data) {
      var guardianshipPoints = []
      for (var i = 0; i < data.length; i++) {
        guardianshipPoints.push(data[i].mergedata)
      }
      this.planObj.GuardianshipPoints += guardianshipPoints.join(',')
    },
    handleSuggestionObject(data) {
      var SuggestionObject = []
      for (var i = 0; i < data.length; i++) {
        SuggestionObject.push(data[i].mergedata)
      }
      this.medicationSuggestionDataObj.SuggestionObject += SuggestionObject.join(',')
    },
    handleSuggestionPoints(data) {
      var SuggestionPoints = []
      for (var i = 0; i < data.length; i++) {
        SuggestionPoints.push(data[i].mergedata)
      }
      this.medicationSuggestionDataObj.SuggestionPoints += SuggestionPoints.join(',')
    },
    handleDoctorcode(data) {
      var names = []
      for (var i = 0; i < data.length; i++) {
        names.push(data[i].doctorname)
      }
      this.medicationSuggestionDataObj.SuggestionDoctor = names.join(',')
    },
    handleSummaryRecordObj(data) {
      var SuggestionObject = []
      for (var i = 0; i < data.length; i++) {
        SuggestionObject.push(data[i].mergedata)
      }
      if (this.summaryRecordObj.RecordObject === '') {
        this.summaryRecordObj.RecordObject += SuggestionObject.join(',')
      } else {
        this.summaryRecordObj.RecordObject += ',' + SuggestionObject.join(',')
      }
    },
    handleSummaryRecordPoints(data) {
      var SuggestionObject = []
      for (var i = 0; i < data.length; i++) {
        SuggestionObject.push(data[i].mergedata)
      }
      if (this.summaryRecordObj.RecordContent === '') {
        this.summaryRecordObj.RecordContent += SuggestionObject.join(',')
      } else {
        this.summaryRecordObj.RecordContent += ',' + SuggestionObject.join(',')
      }
    },
    // 提醒事项 ===========================================
    // 显示弹窗
    showDemindDataDialog() {
      this.demindDataDialog = true
    },
    // 关闭弹窗
    closeDemindDataDialog() {
      this.demindDataDialog = false
      this.demindDataObj = {
        RemindDate: '',
        RemindTxt: ''
      }
    },
    // 保存弹窗
    async saveDemindDataDialog() {
      const tempJson = {
        Userid: this.Userid,
        Username: this.Username,
        Patient_id: this.patientDetail.patient_id,
        Visit_id: this.patientDetail.visit_id,
        Deptcode: this.patientDetail.deptcode,
        // Deptcode: '00191',
        Deptname: this.patientDetail.deptname,
        Bedno: this.patientDetail.bedno,
        RemindDate: this.demindDataObj.RemindDate,
        RemindTxt: this.demindDataObj.RemindTxt,
        Status: '1'
      }
      await gslSaveReminddata({
        json: tempJson
      }).then(res => {
        if (res === '保存成功') {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.closeDemindDataDialog()
        }
      }).catch(err => {
        console.log(err)
      })
    },
    // 提醒事项 ===========================================
    // 显示更多
    showMore() {
      this.sbtnFlag = true
      this.style = ''
    },
    showHide() {
      this.sbtnFlag = false
      this.style = 'height: 60px;padding-top: 10px;'
    },
    clearFun() {
      this.queryInfo = {
        Ordername: '',
        IsTemp: '',
        OrderType: '',
        DrugCode: ''
      }
    },
    // 医嘱分页
    async getpatientOrdersdataList(type) {
      this.page.pagenum = type.page
      this.page.pagesize = type.limit
      await this.gslGetPatientOrdersdata()
    }
  }
}
</script>

<style lang="scss" scoped="scoped">
  #printcontent{
    padding: 20px;
    width: 80%;
    display: flex;
    flex-direction: column;
    text-align: center;
    .fgx{
      margin-top: 10px;
      width: 100%;
      height:1px;
      border:none;
      border-top:2px solid #000000;
    }
    .fgx2{
      width: 100%;
      margin-top: 10px;
      height:2px;
      border:none;
      border-top:2px dotted #000;
    }
    .patient_info{
      width: 100%;
      margin-top: 15px;
      display: flex;
      justify-content: space-between;
      .item{
        display: flex;
      }
    }
    .zyzd{
      text-align: left;
      display: flex;
      justify-content: left;
      margin-top: 15px;
    }
    .tabs{
      margin-top: 15px;
      display: flex;
      flex-direction: column;
      align-items: center;
      .title{
        text-align: left;
        width: 100%;
      }
      .tablecontent{
        margin-top: 10px;
        justify-content: center;
        text-align: center;
        width: 90%;
      }
    }
    .zysx{
      text-align: left;
      .title{

      }
      .item{
        margin-left: 10px;
        .item-title{
          margin: 5px 0;
        }
      }

    }
    .author{
      margin-top: 30px;
      text-align: right;
    }
  }

  body{
    background:#e6edf5;
  }
  .wrapper-guardianshipPlandata{
    .guardianshipPlandata-tab{
      margin-top: 10px;
    }
  }
  .c_searchbtn{
    display:inline-block;
    width:34px;
    height:25px;
    margin-left:3px;
    background:#28a4f4;
    color:#fff;
    font-size:12px;
    text-align:center;
    line-height:26px;
    border-radius:6px;
    cursor:pointer;
  }

  .wrapper{
    padding: 10px;
    border-radius: 5px;
    background-color: #FFFFFF;
    width: 100%;
    .wrapper-tags{
      display: flex;
      justify-content: space-between;
      margin-top: 5px;
      .tags-right{
        padding-right: 5px;
      }
    }
    .wrapper-table{
      width: 100%;
      margin-top: 10px;
    }
  }
  .tags-btn{
    background-color: #fff;
  }
  .query{
    width:100%;
    height:100%;
    background:#e6edf5;
    .check{
      font-size:12px;
      line-height:40px;
      background:#fff;
      text-align:center;
      .c_left{
        width:115px;
        float:left;
        line-height:65px;
      }
      .c_right{
        overflow:hidden;
        color:#636365;
        border-left:1px solid #e6edf5;
        padding:15px 0;
        position:relative;
        .show_btn{
          position:absolute;
          right:20px;
          bottom:15px;
          border:1px solid #e1e1e1;
          background:#f9fafc;
          border-radius:2px;
          text-align:center;
          line-height:32px;
          width:70px;
          height:32px;
          font-size:14px;
          color:#9f9f9f;
          cursor: pointer;
        }
        .fl{
          margin-bottom:10px;
        }
        .c_tip{
          display:inline-block;
          width:80px;
          padding-right:10px;
          text-align:right;
        }
        .c_input{
          width:131px;
          height:40px;
          border:1px solid #dcdfe6;
          border-radius:4px;
          padding-left:5px;
        }
        .c_input::-webkit-input-placeholder {
          color: #dcdfe6;
        }
        .c_input::-ms-input-placeholder {
          color: #dcdfe6;
        }
        .c_input::-moz-input-placeholder {
          color: #dcdfe6;
        }
        .c_search{
          width:90px;
        }
        .c_searchbtn{
          display:inline-block;
          width:34px;
          height:25px;
          margin-left:3px;
          background:#28a4f4;
          color:#fff;
          font-size:12px;
          text-align:center;
          line-height:26px;
          border-radius:6px;
          cursor:pointer;
        }
        .c_checkbox{
          width:230px;
          height:40px;
          display:inline-block;
          margin-left:-12px;
        }
        .btn_clear{
          padding:0;
          width:60px;
          height:40px;
          line-height:40px;
        }
        .sbtn_box{
          text-align:left;
          padding-left:82px;
        }
        .c_select{
          width:130px;
        }
        @media screen and (min-width:1466px){
          .c_select{
            width:150px;
          }
          .btn_clear{
            padding:0;
            width:70px;
            height:40px;
            line-height:40px;
          }
          .c_input{
            width:150px;
          }
          .c_search{
            width:100px;
          }
          .c_searchbtn{
            width:42px;
            margin-left:4px;
          }
          .c_tip{
            width:100px;
          }
        }
      }
    }
    .list_tip{
      font-size:14px;
      color:#29a4f2;
      padding: 2px;
    }
    .table_box{
      padding:0 18px;
    }
  }
  .el-checkbox__label{
    padding-left:5px;
  }
  .el-checkbox{
    margin-right:10px;
  }
  .planPoint{
    display: flex;
    flex-direction: row;
    .plantPointBtn{
      margin-left: 5px;
      display: flex;
      flex-direction: column;
      div{
        margin-bottom: 5px;
      }
    }
  }

  /deep/.el-input{
    width:150px;

    border-radius:4px;
    padding-left:5px;
    font-size: 12px;
  }
  /deep/ .el-card__body{
    padding: 0;
    margin-top: 5px;
    display: flex;
    background-color: #FFFFFF;
    border-radius: 5px;
    height: 100px;
  }
  /deep/.el-table th{
    background:#409efe;color:#fff;font-size:12px;height:36px;padding:0;line-height:36px;text-align:center;border:0;
  }
  /deep/.el-table .cell{
    text-align: center;
    font-size:12px;
  }
  /deep/.el-date-editor{
    width: 200px;
  }
  /deep/.el-textarea__inner{
    height: 80px;
  }
  .c_searchbtn{
    display:inline-block;
    width:34px;
    height:25px;
    margin-left:3px;
    background:#28a4f4;
    color:#fff;
    font-size:12px;
    text-align:center;
    line-height:26px;
    border-radius:6px;
    cursor:pointer;
  }
   .dialog_searchbtn{
     display:inline-block;
     width:34px;
     height:25px;
     margin-left:3px;
     background:#28a4f4;
     color:#fff;
     font-size:12px;
     text-align:center;
     line-height:26px;
     border-radius:6px;
     cursor:pointer;
   }
</style>

